~ubuntu-branches/ubuntu/breezy/koffice/breezy

« back to all changes in this revision

Viewing changes to filters/kword/pdf/xpdf/goo/GString.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Burton
  • Date: 2004-05-09 11:33:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040509113300-vfrdadqsvjfuhn3b
Tags: 1:1.3.1-1
* New upstream bugfix release.
* Built against newer imagemagick (closes: #246623).
* Made koffice-libs/kformula recommend/depend on latex-xft-fonts, which
  provides mathematical fonts that the formula editor can use.  Also
  patched the kformula part to make these fonts the default.
* Changed kword menu hint from "WordProcessors" to "Word processors"
  (closes: #246209).
* Spellchecker configuration is now fixed (closes: #221256, #227568).

Show diffs side-by-side

added added

removed removed

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