1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sistr.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef XML2CMP_SISTR_HXX
32 #define XML2CMP_SISTR_HXX
39 // Constructors, destructor, '=' and typecasts
41 const char * str
= 0);
42 Simstr( // Creates Simstr out of a copy of the described bytes within 'anyBytes'.
43 // Adds a '\0' at the end.
44 const char * anybytes
,
52 operator const char*() const;
54 // diverse utility functions
55 const char * str() const { return sz
; }
56 char * s(); // ATTENTION !!! // Only to be used, when a function needs a 'char*' but
57 // nevertheless THAT WILL BE NOT CHANGED!
58 // Typecasts to 'const char*' are performed automatically.
59 int l() const; // Length of string without '\0' at end.
61 const Simstr
& S
) const;
65 // comparison operators
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;
77 const Simstr
& S
) const;
80 // 'List of characters' - functions
94 void remove_trailing_blanks();
101 bool is_empty() const; // Only true if object == "".
102 bool is_no_text() const; // String may contain spaces or tabs.
104 // substitution functions
109 // get...-functions return the token, separated by char 'c' and leave the object unchanged.
110 // take...-functions return the same, but remove the token and the corresponding separator from the object.
111 Simstr
get_last_token(
119 // Simstr - char* / char - concatenations
120 Simstr
operator+(const char * str
, const Simstr
& S
);
121 Simstr
operator+(const Simstr
& S
, const char * str
);
122 Simstr
operator+(char c
, const Simstr
& S
);
123 Simstr
operator+(const Simstr
& S
, char c
);
125 // Simstr - char* - comparison operators
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 Simstr
& S
, const char * str
);
131 bool operator>=(const Simstr
& S
, const char * str
);
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
);
136 bool operator<=(const char * str
, const Simstr
& S
);
137 bool operator>=(const char * str
, const Simstr
& S
);
141 Simstr::s() { return sz
; }
143 Simstr::l() const { return len
; }
145 Simstr::operator const char*() const { return sz
; }
147 Simstr::is_empty() const { return len
== 0; }