Attribute Class Reference

#include <Attribute.h>

Inheritance diagram for Attribute:

Inheritance graph
[legend]
Collaboration diagram for Attribute:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Attribute (const Wsdl &wsdl, const Xml::XmlNode &node, const std::string &name="", const std::string &ns_prefix="")
 ~Attribute ()
const std::string & Name () const
const std::string & BaseType () const
const std::string Documentation () const
const std::string CType () const
const std::string CName () const
const std::string CName1up () const
bool IsOptional () const
bool IsSimpleType () const
const std::string CType_decl () const
const std::string CType_in () const
const std::string CType_out () const
const std::string DefaultValue () const
bool DefaultIsSet () const
bool FixedIsSet () const
const std::string & Default () const
const std::string & Fixed () const

Private Attributes

std::string m_name
std::string m_base_type
std::string m_use
std::string m_default
bool m_b_default_is_set
std::string m_fixed
bool m_b_fixed_is_set


Detailed Description

Definition at line 31 of file Attribute.h.


Constructor & Destructor Documentation

Attribute::Attribute ( const Wsdl wsdl,
const Xml::XmlNode &  node,
const std::string &  name = "",
const std::string &  ns_prefix = "" 
)

Definition at line 31 of file Attribute.cpp.

References SimpleType::CType(), TypeBase::CType(), Wsdl::FindSimpleType(), IsSimpleType(), m_b_default_is_set, m_b_fixed_is_set, m_base_type, m_default, m_fixed, m_name, TypeBase::m_ns_href, TypeBase::m_type, m_use, TypeBase::m_wsdl, TypeBase::SetType(), and TypeBase::Type().

00032 : TypeBase(wsdl, node, ns_prefix, Split(name).Type)
00033 , m_name(!name.empty() ? name : node.PropertyExists("name") ? node.GetProperty("name") : "")
00034 , m_b_default_is_set(false)
00035 , m_b_fixed_is_set(false)
00036 {
00037         if (node.PropertyExists("type"))
00038         {
00039                 std::string type = node.GetProperty("type");
00040                 SetType(type);
00041         }
00042         else
00043         {
00044                 Xml::XmlNode n(node, "simpleType");
00045                 if (n)
00046                 {
00047                         std::string type = ns_prefix + "::" + Split(m_name).Type + "_t";
00048                         SetType(type);
00049                 }
00050         }
00051         if (node.PropertyExists("use"))
00052                 m_use = node.GetProperty("use");
00053         if (node.PropertyExists("default"))
00054         {
00055                 m_default = node.GetProperty("default");
00056                 m_b_default_is_set = true;
00057         }
00058         if (node.PropertyExists("fixed"))
00059         {
00060                 m_fixed = node.GetProperty("fixed");
00061                 m_b_fixed_is_set = true;
00062         }
00063         //
00064         std::string t = TypeBase::CType();
00065         if (IsSimpleType())
00066         {
00067                 Xml::XmlNode n = m_wsdl.FindSimpleType(m_ns_href, m_type);
00068                 SimpleType sim(m_wsdl, n, Split(m_type).Type, Split(m_type).NS);
00069                 t = sim.CType(); //TypeBase::CType(sim.Type());
00070         }
00071         m_base_type = t;
00072 }

Attribute::~Attribute (  ) 

Definition at line 75 of file Attribute.cpp.

00076 {
00077 }


Member Function Documentation

const std::string& Attribute::Name (  )  const [inline]

Definition at line 37 of file Attribute.h.

References m_name.

Referenced by ComplexType::from_xml(), and ComplexType::to_string().

00037 { return m_name; }

const std::string& Attribute::BaseType (  )  const [inline]

Definition at line 38 of file Attribute.h.

References m_base_type.

Referenced by ComplexType::from_xml(), and ComplexType::to_string().

00038 { return m_base_type; }

const std::string Attribute::Documentation (  )  const

Definition at line 80 of file Attribute.cpp.

References TypeBase::Documentation(), and TypeBase::m_node.

00081 {
00082         return TypeBase::Documentation(m_node);
00083 }

const std::string Attribute::CType (  )  const

Reimplemented from TypeBase.

Definition at line 86 of file Attribute.cpp.

References TypeBase::CType().

Referenced by DefaultValue().

00087 {
00088         return TypeBase::CType();
00089 }

const std::string Attribute::CName (  )  const

Definition at line 92 of file Attribute.cpp.

References m_name.

Referenced by ComplexType::CreateImplementation(), ComplexType::CreateInterface(), and ComplexType::reset_members().

00093 {
00094         return Split(m_name).CName;
00095 }

const std::string Attribute::CName1up (  )  const

Definition at line 98 of file Attribute.cpp.

References m_name.

Referenced by ComplexType::CreateImplementation(), ComplexType::CreateInterface(), ComplexType::from_xml(), and ComplexType::to_string().

00099 {
00100         return Split(m_name).CName1up;
00101 }

bool Attribute::IsOptional (  )  const

Definition at line 104 of file Attribute.cpp.

References m_use.

Referenced by ComplexType::from_xml(), and ComplexType::to_string().

00105 {
00106         return m_use != "required";
00107 }

bool Attribute::IsSimpleType (  )  const

Definition at line 181 of file Attribute.cpp.

References Wsdl::FindSimpleType(), TypeBase::IsBuiltin(), TypeBase::m_ns_href, TypeBase::m_type, and TypeBase::m_wsdl.

Referenced by Attribute(), CType_decl(), CType_in(), and CType_out().

00182 {
00183         if (IsBuiltin())
00184                 return false;
00185         try
00186         {
00187                 Xml::XmlNode n = m_wsdl.FindSimpleType(m_ns_href, m_type);
00188                 return true;
00189         }
00190         catch (const Exception& e)
00191         {
00192         }
00193         return false;
00194 }

const std::string Attribute::CType_decl (  )  const

Definition at line 110 of file Attribute.cpp.

References SimpleType::CType(), TypeBase::CType(), Wsdl::FindSimpleType(), IsSimpleType(), TypeBase::m_ns_href, TypeBase::m_type, TypeBase::m_wsdl, and TypeBase::Type().

Referenced by ComplexType::CreateInterface().

00111 {
00112         std::string t = TypeBase::CType();
00113         if (IsSimpleType())
00114         {
00115                 Xml::XmlNode n = m_wsdl.FindSimpleType(m_ns_href, m_type);
00116                 SimpleType sim(m_wsdl, n, Split(m_type).Type, Split(m_type).NS);
00117                 t = sim.CType(); //TypeBase::CType(sim.Type());
00118         }
00119         return t;
00120 }

const std::string Attribute::CType_in (  )  const

Definition at line 123 of file Attribute.cpp.

References SimpleType::CType(), TypeBase::CType(), Wsdl::FindSimpleType(), TypeBase::IsBuiltin(), IsSimpleType(), TypeBase::m_ns_href, TypeBase::m_type, TypeBase::m_wsdl, and TypeBase::Type().

Referenced by ComplexType::CreateImplementation(), and ComplexType::CreateInterface().

00124 {
00125         std::string t = TypeBase::CType();
00126         if (IsSimpleType())
00127         {
00128                 Xml::XmlNode n = m_wsdl.FindSimpleType(m_ns_href, m_type);
00129                 SimpleType sim(m_wsdl, n, Split(m_type).Type, Split(m_type).NS);
00130                 t = sim.CType(); //TypeBase::CType(sim.Type());
00131         }
00132         if (IsBuiltin() || IsSimpleType())
00133         {
00134                 if (t == "std::string")
00135                 {
00136                         t = "const " + t + "&";
00137                 }
00138         }
00139         else
00140         {
00141                 t = "const " + t + "&";
00142         }
00143         return t;
00144 }

const std::string Attribute::CType_out (  )  const

Definition at line 147 of file Attribute.cpp.

References SimpleType::CType(), TypeBase::CType(), Wsdl::FindSimpleType(), TypeBase::IsBuiltin(), IsSimpleType(), TypeBase::m_ns_href, TypeBase::m_type, TypeBase::m_wsdl, and TypeBase::Type().

Referenced by ComplexType::CreateImplementation(), and ComplexType::CreateInterface().

00148 {
00149         std::string t = TypeBase::CType();
00150         if (IsSimpleType())
00151         {
00152                 Xml::XmlNode n = m_wsdl.FindSimpleType(m_ns_href, m_type);
00153                 SimpleType sim(m_wsdl, n, Split(m_type).Type, Split(m_type).NS);
00154                 t = sim.CType(); //TypeBase::CType(sim.Type());
00155         }
00156         if (IsBuiltin() || IsSimpleType())
00157         {
00158                 if (t == "std::string")
00159                 {
00160                         t = "const " + t + "&";
00161                 }
00162         }
00163         else
00164         {
00165                 t = t + "&";
00166         }
00167         return t;
00168 }

const std::string Attribute::DefaultValue (  )  const

Definition at line 171 of file Attribute.cpp.

References CType(), and TypeBase::IsNumeric().

Referenced by ComplexType::reset_members().

00172 {
00173         if (IsNumeric())
00174                 return "0";
00175         if (CType() == "bool")
00176                 return "false";
00177         return "";
00178 }

bool Attribute::DefaultIsSet (  )  const [inline]

Definition at line 53 of file Attribute.h.

References m_b_default_is_set.

Referenced by ComplexType::reset_members().

00053 { return m_b_default_is_set; }

bool Attribute::FixedIsSet (  )  const [inline]

Definition at line 54 of file Attribute.h.

References m_b_fixed_is_set.

Referenced by ComplexType::reset_members().

00054 { return m_b_fixed_is_set; }

const std::string& Attribute::Default (  )  const [inline]

Definition at line 56 of file Attribute.h.

References m_default.

Referenced by ComplexType::reset_members().

00056 { return m_default; }

const std::string& Attribute::Fixed (  )  const [inline]

Definition at line 57 of file Attribute.h.

References m_fixed.

Referenced by ComplexType::reset_members().

00057 { return m_fixed; }


Member Data Documentation

std::string Attribute::m_name [private]

Definition at line 60 of file Attribute.h.

Referenced by Attribute(), CName(), CName1up(), and Name().

std::string Attribute::m_base_type [private]

Definition at line 61 of file Attribute.h.

Referenced by Attribute(), and BaseType().

std::string Attribute::m_use [private]

Definition at line 62 of file Attribute.h.

Referenced by Attribute(), and IsOptional().

std::string Attribute::m_default [private]

Definition at line 63 of file Attribute.h.

Referenced by Attribute(), and Default().

Definition at line 64 of file Attribute.h.

Referenced by Attribute(), and DefaultIsSet().

std::string Attribute::m_fixed [private]

Definition at line 65 of file Attribute.h.

Referenced by Attribute(), and Fixed().

Definition at line 66 of file Attribute.h.

Referenced by Attribute(), and FixedIsSet().


The documentation for this class was generated from the following files:

Generated on Sun Oct 11 10:57:20 2009 for Xml Schema class generator by  doxygen 1.5.5