Update ooo320-m1
[ooovba.git] / autodoc / inc / ary / qualiname.hxx
blob384d5cd64585bd21667ca9332965004e1b337e36
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: qualiname.hxx,v $
10 * $Revision: 1.4 $
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
36 // USED SERVICES
37 // BASE CLASSES
38 // COMPONENTS
39 // PARAMETERS
40 #include <cosv/tpl/tpltools.hxx>
43 namespace ary
46 class QualifiedName
48 public:
49 typedef StringVector::const_iterator namespace_iterator;
51 QualifiedName(
52 uintt i_nSize = 0);
54 /// @see AssignText()
55 QualifiedName(
56 const char * i_sText,
57 const char * i_sSeparator );
58 ~QualifiedName();
60 QualifiedName & operator+=(
61 const String & i_sNamespaceName )
62 { if (i_sNamespaceName.length() > 0)
63 aNamespace.push_back(i_sNamespaceName);
64 return *this; }
65 /// @precond i_nIndex < NamespaceDepth().
66 String & operator[](
67 uintt i_nIndex )
68 { csv_assert(i_nIndex < aNamespace.size());
69 return aNamespace[i_nIndex]; }
70 void Init(
71 bool i_bAbsolute )
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
75 true.
77 void AssignText(
78 const char * i_sText,
79 const char * i_sSeparator );
80 void SetLocalName(
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; }
94 private:
95 // DATA
96 StringVector aNamespace;
97 String sLocalName;
98 bool bIsAbsolute; /// true := beginning with "::".
99 bool bIsFunction; /// true := ending with "()"
105 } // namespace ary
106 #endif