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: qualiname.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 ARY_QUALINAME_HXX
32 #define ARY_QUALINAME_HXX
40 #include <cosv/tpl/tpltools.hxx>
49 typedef StringVector::const_iterator namespace_iterator
;
57 const char * i_sSeparator
);
60 QualifiedName
& operator+=(
61 const String
& i_sNamespaceName
)
62 { if (i_sNamespaceName
.length() > 0)
63 aNamespace
.push_back(i_sNamespaceName
);
65 /// @precond i_nIndex < NamespaceDepth().
68 { csv_assert(i_nIndex
< aNamespace
.size());
69 return aNamespace
[i_nIndex
]; }
72 { Empty(); bIsAbsolute
= i_bAbsolute
; }
73 /** Reads a qualified name from a string.
74 If the last two charcters are "()", the inquiry IsFunction() will return
79 const char * i_sSeparator
);
81 const String
& i_sLocalName
)
82 { sLocalName
= i_sLocalName
; }
83 void Empty() { csv::erase_container(aNamespace
); sLocalName
.clear(); bIsAbsolute
= false; }
85 const String
& LocalName() const { return sLocalName
; }
86 namespace_iterator
first_namespace() const { return aNamespace
.begin(); }
87 namespace_iterator
end_namespace() const { return aNamespace
.end(); }
88 uintt
NamespaceDepth() const { return aNamespace
.size(); }
90 bool IsAbsolute() const { return bIsAbsolute
; }
91 bool IsQualified() const { return aNamespace
.size() > 0; }
92 bool IsFunction() const { return bIsFunction
; }
96 StringVector aNamespace
;
98 bool bIsAbsolute
; /// true := beginning with "::".
99 bool bIsFunction
; /// true := ending with "()"