1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef XML2CMP_SISTR_HXX
30 #define XML2CMP_SISTR_HXX
37 // Constructors, destructor, '=' and typecasts
39 const char * str
= 0);
40 Simstr( // Creates Simstr out of a copy of the described bytes within 'anyBytes'.
41 // Adds a '\0' at the end.
42 const char * anybytes
,
50 operator const char*() const;
52 // diverse utility functions
53 const char * str() const { return sz
; }
54 char * s(); // CAUTION!!! // Only use when a function needs a 'char*' but
55 // still will NOT MODIFY THE STRING!
56 // Typecasts to 'const char*' are performed automatically.
57 int l() const; // Length of string without '\0' at end.
59 const Simstr
& S
) const;
63 // comparison operators
65 const Simstr
& S
) const;
67 const Simstr
& S
) const;
69 const Simstr
& S
) const;
71 const Simstr
& S
) const;
73 const Simstr
& S
) const;
75 const Simstr
& S
) const;
78 // 'List of characters' - functions
92 void remove_trailing_blanks();
99 bool is_empty() const; // Only true if object == "".
100 bool is_no_text() const; // String may contain spaces or tabs.
102 // substitution functions
107 // get...-functions return the token, separated by char 'c' and leave the object unchanged.
108 // take...-functions return the same, but remove the token and the corresponding separator from the object.
109 Simstr
get_last_token(
117 // Simstr - char* / char - concatenations
118 Simstr
operator+(const char * str
, const Simstr
& S
);
119 Simstr
operator+(const Simstr
& S
, const char * str
);
120 Simstr
operator+(char c
, const Simstr
& S
);
121 Simstr
operator+(const Simstr
& S
, char c
);
123 // Simstr - char* - comparison operators
124 bool operator==(const Simstr
& S
, const char * str
);
125 bool operator!=(const Simstr
& S
, const char * str
);
126 bool operator<(const Simstr
& S
, const char * str
);
127 bool operator>(const Simstr
& S
, const char * str
);
128 bool operator<=(const Simstr
& S
, const char * str
);
129 bool operator>=(const Simstr
& S
, const char * str
);
130 bool operator==(const char * str
, const Simstr
& S
);
131 bool operator!=(const char * str
, const Simstr
& S
);
132 bool operator<(const char * str
, const Simstr
& S
);
133 bool operator>(const char * str
, const Simstr
& S
);
134 bool operator<=(const char * str
, const Simstr
& S
);
135 bool operator>=(const char * str
, const Simstr
& S
);
139 Simstr::s() { return sz
; }
141 Simstr::l() const { return len
; }
143 Simstr::operator const char*() const { return sz
; }
145 Simstr::is_empty() const { return len
== 0; }
150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */