Sha256: b8f10519fd233d497558bb6713d7245419cd53085e43b34f53633b024ea1ba64

Contents?: true

Size: 1.89 KB

Versions: 24

Compression:

Stored size: 1.89 KB

Contents

/*
 Copyright 2018 Stephen Checkoway

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
*/

#ifndef GUMBO_TOKEN_BUFFER_H
#define GUMBO_TOKEN_BUFFER_H

#include <stdbool.h>
#include <stddef.h>

#include "gumbo.h"

#ifdef __cplusplus
extern "C" {
#endif

struct GumboInternalCharacterToken;
struct GumboInternalToken;

// A struct representing a growable sequence of character (and whitespace)
// tokens.
typedef struct {
  // A pointer to the start of the sequence.
  struct GumboInternalCharacterToken* data;

  // The length of the sequence.
  size_t length;

  // The capacity of the buffer.
  size_t capacity;
} GumboCharacterTokenBuffer;

// Initializes a new GumboCharacterTokenBuffer.
void gumbo_character_token_buffer_init(GumboCharacterTokenBuffer* buffer);

// Appends a character (or whitespace) token.
void gumbo_character_token_buffer_append (
  const struct GumboInternalToken* token,
  GumboCharacterTokenBuffer* buffer
);

void gumbo_character_token_buffer_get (
  const GumboCharacterTokenBuffer* buffer,
  size_t index,
  struct GumboInternalToken* output
);

// Reinitialize this string buffer. This clears it by setting length=0. It
// does not zero out the buffer itself.
void gumbo_character_token_buffer_clear(GumboCharacterTokenBuffer* buffer);

// Deallocates this GumboCharacterTokenBuffer.
void gumbo_character_token_buffer_destroy(GumboCharacterTokenBuffer* buffer);

#ifdef __cplusplus
}
#endif

#endif // GUMBO_TOKEN_BUFFER_H

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
nokogiri-1.13.10 gumbo-parser/src/token_buffer.h
nokogiri-1.13.9 gumbo-parser/src/token_buffer.h
nokogiri-1.13.8 gumbo-parser/src/token_buffer.h
nokogiri-1.13.7 gumbo-parser/src/token_buffer.h
nokogiri-1.13.6 gumbo-parser/src/token_buffer.h
nokogiri-1.13.5 gumbo-parser/src/token_buffer.h
nokogiri-1.13.4 gumbo-parser/src/token_buffer.h
nokogiri-1.13.3 gumbo-parser/src/token_buffer.h
nokogiri-1.13.2 gumbo-parser/src/token_buffer.h
nokogiri-1.13.1 gumbo-parser/src/token_buffer.h
nokogiri-1.13.0 gumbo-parser/src/token_buffer.h
nokogiri-1.12.5 gumbo-parser/src/token_buffer.h
nokogiri-1.12.4 gumbo-parser/src/token_buffer.h
nokogiri-1.12.3 gumbo-parser/src/token_buffer.h
nokogiri-1.12.2 gumbo-parser/src/token_buffer.h
nokogiri-1.12.1 gumbo-parser/src/token_buffer.h
nokogiri-1.12.0 gumbo-parser/src/token_buffer.h
nokogiri-1.12.0.rc1 gumbo-parser/src/token_buffer.h
nokogumbo-2.0.5 gumbo-parser/src/token_buffer.h
nokogumbo-2.0.4 gumbo-parser/src/token_buffer.h