source: trunk/poppler/mypoppler/goo/GooString.h @ 2

Last change on this file since 2 was 2, checked in by Eugene Romanenko, 15 years ago

First import

File size: 2.2 KB
RevLine 
[2]1//========================================================================
2//
3// GooString.h
4//
5// Simple variable-length string type.
6//
7// Copyright 1996-2003 Glyph & Cog, LLC
8//
9//========================================================================
10
11#ifndef GSTRING_H
12#define GSTRING_H
13
14#ifdef USE_GCC_PRAGMAS
15#pragma interface
16#endif
17
18#include "gtypes.h"
19
20class GooString {
21public:
22
23  // Create an empty string.
24  GooString();
25
26  // Create a string from a C string.
27  GooString(const char *sA);
28
29  // Create a string from <lengthA> chars at <sA>.  This string
30  // can contain null characters.
31  GooString(const char *sA, int lengthA);
32
33  // Create a string from <lengthA> chars at <idx> in <str>.
34  GooString(GooString *str, int idx, int lengthA);
35
36  // Copy a string.
37  GooString(GooString *str);
38  GooString *copy() { return new GooString(this); }
39
40  // Concatenate two strings.
41  GooString(GooString *str1, GooString *str2);
42
43  // Convert an integer to a string.
44  static GooString *fromInt(int x);
45
46  // Destructor.
47  ~GooString();
48
49  // Get length.
50  int getLength() { return length; }
51
52  // Get C string.
53  char *getCString() { return s; }
54
55  // Get <i>th character.
56  char getChar(int i) { return s[i]; }
57
58  // Change <i>th character.
59  void setChar(int i, char c) { s[i] = c; }
60
61  // Clear string to zero length.
62  GooString *clear();
63
64  // Append a character or string.
65  GooString *append(char c);
66  GooString *append(GooString *str);
67  GooString *append(const char *str);
68  GooString *append(const char *str, int lengthA);
69
70  // Insert a character or string.
71  GooString *insert(int i, char c);
72  GooString *insert(int i, GooString *str);
73  GooString *insert(int i, const char *str);
74  GooString *insert(int i, const char *str, int lengthA);
75
76  // Delete a character or range of characters.
77  GooString *del(int i, int n = 1);
78
79  // Convert string to all-upper/all-lower case.
80  GooString *upperCase();
81  GooString *lowerCase();
82
83  // Compare two strings:  -1:<  0:=  +1:>
84  int cmp(GooString *str);
85  int cmpN(GooString *str, int n);
86  int cmp(const char *sA);
87  int cmpN(const char *sA, int n);
88
89  GBool hasUnicodeMarker(void);
90
91private:
92
93  int length;
94  char *s;
95
96  void resize(int length1);
97};
98
99#endif
Note: See TracBrowser for help on using the repository browser.