Cogs.Core
Extensions
Gui
Libraries
litehtml
src
gumbo
vector.h
1
// Copyright 2010 Google Inc. All Rights Reserved.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
//
15
// Author: jdtang@google.com (Jonathan Tang)
16
17
#ifndef GUMBO_VECTOR_H_
18
#define GUMBO_VECTOR_H_
19
20
#include "
gumbo.h
"
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
// Forward declaration since it's passed into some of the functions in this
27
// header.
28
struct
GumboInternalParser
;
29
30
// Initializes a new GumboVector with the specified initial capacity.
31
void
gumbo_vector_init(
struct
GumboInternalParser
* parser,
32
size_t
initial_capacity,
GumboVector
* vector);
33
34
// Frees the memory used by an GumboVector. Does not free the contained
35
// pointers.
36
void
gumbo_vector_destroy(
37
struct
GumboInternalParser
* parser,
GumboVector
* vector);
38
39
// Adds a new element to an GumboVector.
40
void
gumbo_vector_add(
41
struct
GumboInternalParser
* parser,
void
* element,
GumboVector
* vector);
42
43
// Removes and returns the element most recently added to the GumboVector.
44
// Ownership is transferred to caller. Capacity is unchanged. If the vector is
45
// empty, NULL is returned.
46
void
* gumbo_vector_pop(
struct
GumboInternalParser
* parser,
GumboVector
* vector);
47
48
// Inserts an element at a specific index. This is potentially O(N) time, but
49
// is necessary for some of the spec's behavior.
50
void
gumbo_vector_insert_at(
struct
GumboInternalParser
* parser,
void
* element,
51
unsigned
int
index,
GumboVector
* vector);
52
53
// Removes an element from the vector, or does nothing if the element is not in
54
// the vector.
55
void
gumbo_vector_remove(
56
struct
GumboInternalParser
* parser,
void
* element,
GumboVector
* vector);
57
58
// Removes and returns an element at a specific index. Note that this is
59
// potentially O(N) time and should be used sparingly.
60
void
* gumbo_vector_remove_at(
struct
GumboInternalParser
* parser,
61
unsigned
int
index,
GumboVector
* vector);
62
63
#ifdef __cplusplus
64
}
65
#endif
66
67
#endif
// GUMBO_VECTOR_H_
gumbo.h
GumboInternalParser
Definition:
parser.h:35
GumboVector
Definition:
gumbo.h:124
Generated by
1.9.6