4 #include "ace/SString.h"
7 ImR_Utils::activationModeToString (ImplementationRepository::ActivationMode mode
)
11 case ImplementationRepository::NORMAL
:
13 case ImplementationRepository::MANUAL
:
15 case ImplementationRepository::PER_CLIENT
:
17 case ImplementationRepository::AUTO_START
:
20 ACE_ASSERT(mode
== ImplementationRepository::NORMAL
);
25 ImplementationRepository::ActivationMode
26 ImR_Utils::stringToActivationMode (const ACE_CString
& s
)
29 return ImplementationRepository::NORMAL
;
31 return ImplementationRepository::MANUAL
;
32 if (s
== "PER_CLIENT")
33 return ImplementationRepository::PER_CLIENT
;
34 if (s
== "AUTO_START")
35 return ImplementationRepository::AUTO_START
;
37 return ImplementationRepository::NORMAL
;
41 ImR_Utils::envListToString(const ImplementationRepository::EnvironmentList
& lst
)
43 static ACE_CString ret
;
45 for (CORBA::ULong n
= 0; n
< lst
.length(); ++n
)
48 ret
+= lst
[n
].name
.in();
50 ret
+= lst
[n
].value
.in();
57 ImR_Utils::stringToEnvList(const ACE_CString
& s
,
58 ImplementationRepository::EnvironmentList
& ret
)
60 const ACE_CString NAMETAG
= "name=\"";
61 const ACE_CString VALTAG
= "value=\"";
62 const ACE_CString ENDTAG
= "\"";
68 for (pos
= s
.find ('\n'); pos
!= ACE_CString::npos
; pos
= s
.find ('\n',pos
+ 1))
78 ACE_CString source
= s
;
79 for (idx
= 0; idx
< ret
.length () ;idx
++)
81 pos
= source
.find ("\n");
82 ACE_CString entry
= source
.substr (0,pos
);
83 source
= source
.substr (pos
+ 1);
87 if ((start
= entry
.find (NAMETAG
)) == ACE_CString::npos
)
89 start
+= NAMETAG
.length();
90 if ((pos
= entry
.find (ENDTAG
, start
+ 1)) == ACE_CString::npos
)
92 ret
[idx
].name
= entry
.substr (start
, pos
- start
).c_str();
95 if ((start
= entry
.find (VALTAG
, pos
)) == ACE_CString::npos
)
97 start
+= VALTAG
.length ();
98 if ((pos
= entry
.find (ENDTAG
, start
+ 1)) == ACE_CString::npos
)
100 ret
[idx
].value
= entry
.substr (start
, pos
- start
).c_str();
105 ImR_Utils::peerListToString (const CORBA::StringSeq
& lst
)
107 static ACE_CString ret
;
109 for (CORBA::ULong n
= 0; n
< lst
.length(); ++n
)
119 ImR_Utils::stringToPeerList (const ACE_CString
& s
, CORBA::StringSeq
& ret
)
121 const ACE_CString NAMETAG
= "name=\"";
122 const ACE_CString ENDTAG
= "\"";
127 CORBA::ULong idx
= 0;
128 for (pos
= s
.find ('\n'); pos
!= ACE_CString::npos
; pos
= s
.find ('\n',pos
+ 1))
138 ACE_CString source
= s
;
139 for (idx
= 0; idx
< ret
.length () ;idx
++)
141 pos
= source
.find ("\n");
142 ACE_CString entry
= source
.substr (0,pos
);
143 source
= source
.substr (pos
+ 1);
146 if ((start
= entry
.find (NAMETAG
)) == ACE_CString::npos
)
148 start
+= NAMETAG
.length();
149 if ((pos
= entry
.find (ENDTAG
, start
+ 1)) == ACE_CString::npos
)
151 ret
[idx
] = entry
.substr (start
, pos
- start
).c_str();