wsdlpull
1.23
Toggle main menu visibility
Loading...
Searching...
No Matches
src
xmlpull
Qname.h
Go to the documentation of this file.
1
/*
2
* wsdlpull - A C++ parser for WSDL (Web services description language)
3
* Copyright (C) 2005-2007 Vivek Krishna
4
*
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Library General Public
7
* License as published by the Free Software Foundation; either
8
* version 2 of the License, or (at your option) any later version.
9
*
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Library General Public License for more details.
14
*
15
* You should have received a copy of the GNU Library General Public
16
* License along with this library; if not, write to the Free
17
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
*
19
*
20
*/
21
#ifndef _QNAMEH
22
#define _QNAMEH
23
#include <string>
24
#include <iostream>
25
#ifdef HAVE_CONFIG_H
//
26
#include <config.h>
27
#endif
28
#include "
wsdlpull_export.h
"
29
30
class
WSDLPULL_EXPORT
Qname
31
{
32
public
:
33
Qname
(
const
std::string & name);
34
Qname
(
const
Qname
& qn);
35
Qname
();
36
std::string
getLocalName
(
void
)
const
;
37
std::string
getPrefix
(
void
)
const
;
38
std::string
getNamespace
(
void
)
const
;
39
void
setNamespace
(std::string uri);
40
bool
operator== (
const
Qname
& qn)
const
;
41
void
operator= (
const
std::string & name);
42
friend
std::ostream &
operator<<
(std::ostream & os,
const
Qname
& qn);
43
private
:
44
void
parse (
const
std::string & name);
45
std::string namespaceUri, localname, prefix;
46
};
47
48
inline
49
Qname::Qname
(
const
std::string & name)
50
{
51
parse (name);
52
}
53
54
inline
55
Qname::Qname
(
const
Qname
& qn)
56
{
57
localname = qn.localname;
58
prefix = qn.prefix;
59
namespaceUri = qn.namespaceUri;
60
}
61
62
inline
63
Qname::Qname
()
64
{
65
}
66
67
inline
68
void
69
Qname::operator=
(
const
std::string & name)
70
{
71
parse (name);
72
}
73
74
inline
75
std::string
76
Qname::getLocalName
(
void
)
const
77
{
78
return
localname;
79
}
80
81
inline
82
std::string
83
Qname::getPrefix
(
void
)
const
84
{
85
return
prefix;
86
}
87
88
inline
89
std::string
90
Qname::getNamespace
(
void
)
const
91
{
92
return
namespaceUri;
93
}
94
95
inline
96
void
97
Qname::setNamespace
(std::string uri)
98
{
99
namespaceUri = uri;
100
}
101
102
inline
103
bool
104
Qname::operator==
(
const
Qname
& qn)
const
105
{
106
if
(qn.
getNamespace
() == namespaceUri && qn.
getLocalName
() == localname)
107
return
true
;
108
else
109
return
false
;
110
}
111
112
inline
113
void
114
Qname::parse (
const
std::string & name)
115
{
116
int
cut = -1;
117
if
(name.empty ())
118
return
;
119
cut = name.find (
":"
);
120
if
(cut == -1 || cut == 0)
121
localname = name;
122
123
else
124
125
{
126
localname = name.substr (cut + 1);
127
prefix = name.substr (0, cut);
128
}
129
cut = localname.find (
"[]"
);
130
if
(cut > 0)
131
localname = localname.substr (0, cut);
132
}
133
134
inline
135
std::ostream &
136
operator<<
(std::ostream & os,
const
Qname
& qn)
137
{
138
os<<qn.
getPrefix
()<<
"{"
<<qn.
getNamespace
()<<
"}:"
<<qn.
getLocalName
();
139
return
os;
140
}
141
#endif
/* */
operator<<
std::ostream & operator<<(std::ostream &os, const ConfigFile &cf)
Definition
ConfigFile.cpp:73
operator<<
std::ostream & operator<<(std::ostream &os, const Qname &qn)
Definition
Qname.h:136
Qname::getLocalName
std::string getLocalName(void) const
Definition
Qname.h:76
Qname::setNamespace
void setNamespace(std::string uri)
Definition
Qname.h:97
Qname::getPrefix
std::string getPrefix(void) const
Definition
Qname.h:83
Qname::Qname
Qname(const std::string &name)
Definition
Qname.h:49
Qname::operator==
bool operator==(const Qname &qn) const
Definition
Qname.h:104
Qname::operator=
void operator=(const std::string &name)
Definition
Qname.h:69
Qname::Qname
Qname()
Definition
Qname.h:63
Qname::getNamespace
std::string getNamespace(void) const
Definition
Qname.h:90
wsdlpull_export.h
WSDLPULL_EXPORT
#define WSDLPULL_EXPORT
Definition
wsdlpull_export.h:30
Generated by
1.17.0