root/trunk/ssphys/SSPhysLib/SSName.cpp

Revision 157 (checked in by ldavis, 4 years ago)

added svn:eol-style to all files
added svn:mime-type to all files

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
Line 
1 // SSName.cpp: implementation of the SSName class.
2 //
3 //////////////////////////////////////////////////////////////////////
4
5 #include "StdAfx.h"
6 #include "SSName.h"
7 //#include "SSDatabase.h"
8
9
10 //////////////////////////////////////////////////////////////////////
11 // Construction/Destruction
12 //////////////////////////////////////////////////////////////////////
13
14 SSName::SSName(SSNAME ssname, SSNamesCache* pNameService)
15   : m_ssName (ssname),
16     m_pNamesService (pNameService)
17 {
18 //  if (!m_pNamesService && SSDatabase::GetCurrentDatabase ())
19 //    m_pNamesService = SSDatabase::GetCurrentDatabase ()->GetNamesService ();
20 }
21
22 SSName::~SSName()
23 {
24
25 }
26
27 //---------------------------------------------------------------------------
28 long SSName::GetOffset () const
29 {
30   return m_ssName.nsmap;
31 }
32
33 //---------------------------------------------------------------------------
34 std::string SSName::GetType () const
35 {
36   switch (m_ssName.flags)
37   {
38   case 0:
39     return "file";
40   case 1:
41     return "project";
42   }
43   return "type unknown";
44 }
45
46 //---------------------------------------------------------------------------
47 std::string SSName::GetFullName () const
48 {
49   std::string name = m_ssName.name;
50   if (m_pNamesService && m_ssName.nsmap != 0UL)
51   {
52     std::string altName = m_pNamesService->GetName (m_ssName.flags, m_ssName.nsmap);
53     if (!altName.empty ())
54       name = altName;
55   }
56   return name;
57 }
58
59 //---------------------------------------------------------------------------
60 std::ostream& operator<<(std::ostream& os, const SSName& ssname)
61 {
62   os << ssname.GetFullName ();
63  
64   return os;
65 }
66
67 // ---------------------------------------------------------------
68 void SSName::ToXml (XMLNode* pParent, std::string name /*= "SSName"*/)
69 {
70   std::stringstream stream;
71   stream << GetOffset ();
72   AttribMap map;
73   map["type"] = GetType ();
74   map["offset"] = stream.str();
75   XMLElement node (pParent, name, map, GetFullName ());
76 };
Note: See TracBrowser for help on using the browser.

PumaCode.org recommends CVSDude for fast, professional Subversion and Trac hosting:

CVSDude.com

These ads are automatically generated by Google. Revenue from these ads helps to pay for hosting this site; however, these ads do not constitute an endorsement by PumaCode.org.