typeident.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2006-2008 The FLWOR Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  * 
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef ZORBA_TYPES_TYPEIDENT_H
00017 #define ZORBA_TYPES_TYPEIDENT_H
00018 
00019 #include <zorba/config.h>
00020 #include <zorba/api_shared_types.h>
00021 #include <zorba/identtypes.h>
00022 #include <zorba/zorba_string.h>
00023 #include <iostream>
00024 
00025 namespace zorba {
00026 
00027 /** \brief Type identifiers
00028  *
00029  * The type identifiers are not used, yet.
00030  *
00031  * Note: This class is reference counted. When writing multi-threaded clients,
00032  * it is the responibility of the client code to synchronize assignments to the
00033  * SmartPtr holding this object.
00034  */
00035 class ZORBA_DLL_PUBLIC TypeIdentifier : public SmartObject {
00036   public:
00037     /** \brief Destructor
00038      */
00039     ~TypeIdentifier();
00040 
00041     static
00042     TypeIdentifier_t
00043     createNamedType(
00044         const String& uri,
00045         const String& localName,
00046         IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
00047         );
00048 
00049     static
00050     TypeIdentifier_t
00051     createElementType(
00052         const String& uri,
00053         bool uriWildcard,
00054         const String& localName,
00055         bool localNameWildcard,
00056         TypeIdentifier_t contentType,
00057         IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
00058         );
00059 
00060     static
00061     TypeIdentifier_t
00062     createAttributeType(
00063         const String& uri,
00064         bool uriWildcard,
00065         const String& localName,
00066         bool localNameWildcard,
00067         TypeIdentifier_t contentType,
00068         IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
00069         );
00070 
00071     static
00072     TypeIdentifier_t
00073     createDocumentType(
00074         TypeIdentifier_t contentType,
00075         IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
00076         );
00077 
00078     static
00079     TypeIdentifier_t
00080     createPIType(
00081         IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
00082         );
00083 
00084     static
00085     TypeIdentifier_t
00086     createTextType(
00087         IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
00088         );
00089 
00090     static
00091     TypeIdentifier_t
00092     createCommentType(
00093         IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
00094         );
00095 
00096     static
00097     TypeIdentifier_t
00098     createAnyNodeType(
00099         IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
00100         );
00101 
00102     static
00103     TypeIdentifier_t
00104     createItemType(
00105         IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
00106         );
00107 
00108     static
00109     TypeIdentifier_t
00110     createEmptyType();
00111 
00112     static
00113     TypeIdentifier_t
00114     createSchemaElementType(
00115         const String& uri,
00116         const String& localName,
00117         IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
00118         );
00119   
00120     static
00121     TypeIdentifier_t
00122     createSchemaAttributeType(
00123         const String& uri,
00124         const String& localName,
00125         IdentTypes::quantifier_t quantifier = IdentTypes::QUANT_ONE
00126         );
00127   
00128     IdentTypes::kind_t
00129     getKind() const;
00130 
00131     IdentTypes::quantifier_t
00132     getQuantifier() const;
00133 
00134     const String&
00135     getUri() const;
00136 
00137     bool
00138     isUriWildcard() const;
00139 
00140     const String&
00141     getLocalName() const;
00142 
00143     bool
00144     isLocalNameWildcard() const;
00145 
00146     TypeIdentifier_t
00147     getContentType() const;
00148 
00149     std::ostream&
00150     emit(std::ostream&) const;
00151 
00152   private:
00153     TypeIdentifier();
00154 
00155     std::ostream&
00156     emitItemType(std::ostream&) const;
00157 
00158     std::ostream&
00159     emitName(std::ostream&) const;
00160 
00161     IdentTypes::kind_t m_kind;
00162     IdentTypes::quantifier_t m_quantifier;
00163     String m_uri;
00164     bool m_uriWildcard;
00165     String m_localName;
00166     bool m_localNameWildcard;
00167     TypeIdentifier_t m_contentType;
00168 };
00169 
00170 #ifdef WIN32
00171   template class ZORBA_DLL_PUBLIC  zorba::SmartPtr<TypeIdentifier>;
00172 #endif
00173 
00174 
00175 } /* namespace zorba */
00176 
00177 namespace std {
00178 
00179 ZORBA_DLL_PUBLIC ostream& operator<<(ostream& o, const zorba::TypeIdentifier& ti);
00180 ZORBA_DLL_PUBLIC ostream& operator<<(ostream& o, const zorba::TypeIdentifier_t ti);
00181 
00182 }
00183 
00184 #endif /* ZORBA_TYPES_TYPEIDENT_H */
00185 /* vim:set et sw=2 ts=2: */
blog comments powered by Disqus