Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ipaaca
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ramin Yaghoubzadeh Torky
ipaaca
Commits
e2a56cda
Commit
e2a56cda
authored
12 years ago
by
Ramin Yaghoubzadeh
Browse files
Options
Downloads
Patches
Plain Diff
C++: added bool casting for payloads. Added overloaded setters.
parent
52d54644
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
ipaacalib/cpp/include/ipaaca/ipaaca.h
+8
-1
8 additions, 1 deletion
ipaacalib/cpp/include/ipaaca/ipaaca.h
ipaacalib/cpp/src/ipaaca.cc
+26
-2
26 additions, 2 deletions
ipaacalib/cpp/src/ipaaca.cc
with
34 additions
and
3 deletions
ipaacalib/cpp/include/ipaaca/ipaaca.h
+
8
−
1
View file @
e2a56cda
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include
<boost/thread.hpp>
#include
<boost/thread.hpp>
#include
<boost/shared_ptr.hpp>
#include
<boost/shared_ptr.hpp>
#include
<boost/pointer_cast.hpp>
#include
<boost/pointer_cast.hpp>
#include
<boost/lexical_cast.hpp>
#include
<rsc/runtime/TypeStringTools.h>
#include
<rsc/runtime/TypeStringTools.h>
#include
<rsb/Factory.h>
#include
<rsb/Factory.h>
...
@@ -409,12 +410,18 @@ class PayloadEntryProxy//{{{
...
@@ -409,12 +410,18 @@ class PayloadEntryProxy//{{{
public:
public:
PayloadEntryProxy
(
Payload
*
payload
,
const
std
::
string
&
key
);
PayloadEntryProxy
(
Payload
*
payload
,
const
std
::
string
&
key
);
PayloadEntryProxy
&
operator
=
(
const
std
::
string
&
value
);
PayloadEntryProxy
&
operator
=
(
const
std
::
string
&
value
);
PayloadEntryProxy
&
operator
=
(
const
char
*
value
);
PayloadEntryProxy
&
operator
=
(
double
value
);
PayloadEntryProxy
&
operator
=
(
bool
value
);
operator
std
::
string
();
operator
std
::
string
();
operator
long
();
operator
long
();
operator
double
();
operator
double
();
operator
bool
();
inline
std
::
string
to_str
()
{
return
operator
std
::
string
();
}
inline
std
::
string
to_str
()
{
return
operator
std
::
string
();
}
inline
long
to_int
()
{
return
operator
long
();
}
//inline long to_int() { return operator long(); }
inline
long
to_long
()
{
return
operator
long
();
}
inline
double
to_float
()
{
return
operator
double
();
}
inline
double
to_float
()
{
return
operator
double
();
}
inline
bool
to_bool
()
{
return
operator
bool
();
}
};
//}}}
};
//}}}
class
Payload
//{{{
class
Payload
//{{{
...
...
This diff is collapsed.
Click to expand it.
ipaacalib/cpp/src/ipaaca.cc
+
26
−
2
View file @
e2a56cda
...
@@ -993,20 +993,44 @@ PayloadEntryProxy::PayloadEntryProxy(Payload* payload, const std::string& key)
...
@@ -993,20 +993,44 @@ PayloadEntryProxy::PayloadEntryProxy(Payload* payload, const std::string& key)
}
}
PayloadEntryProxy
&
PayloadEntryProxy
::
operator
=
(
const
std
::
string
&
value
)
PayloadEntryProxy
&
PayloadEntryProxy
::
operator
=
(
const
std
::
string
&
value
)
{
{
std
::
cout
<<
"operator=(string)"
<<
std
::
endl
;
_payload
->
set
(
_key
,
value
);
_payload
->
set
(
_key
,
value
);
return
*
this
;
return
*
this
;
}
}
PayloadEntryProxy
&
PayloadEntryProxy
::
operator
=
(
const
char
*
value
)
{
std
::
cout
<<
"operator=(const char*)"
<<
std
::
endl
;
_payload
->
set
(
_key
,
value
);
return
*
this
;
}
PayloadEntryProxy
&
PayloadEntryProxy
::
operator
=
(
double
value
)
{
std
::
cout
<<
"operator=(double)"
<<
std
::
endl
;
_payload
->
set
(
_key
,
boost
::
lexical_cast
<
std
::
string
>
(
value
));
return
*
this
;
}
PayloadEntryProxy
&
PayloadEntryProxy
::
operator
=
(
bool
value
)
{
std
::
cout
<<
"operator=(bool)"
<<
std
::
endl
;
_payload
->
set
(
_key
,
boost
::
lexical_cast
<
std
::
string
>
(
value
));
return
*
this
;
}
PayloadEntryProxy
::
operator
std
::
string
()
PayloadEntryProxy
::
operator
std
::
string
()
{
{
return
_payload
->
get
(
_key
);
return
_payload
->
get
(
_key
);
}
}
PayloadEntryProxy
::
operator
bool
()
{
std
::
string
s
=
operator
std
::
string
();
return
((
s
==
"1"
)
||
(
s
==
"true"
)
||
(
s
==
"True"
));
}
PayloadEntryProxy
::
operator
long
()
PayloadEntryProxy
::
operator
long
()
{
{
return
atol
(
operator
std
::
string
().
c_str
());
return
boost
::
lexical_cast
<
long
>
(
operator
std
::
string
().
c_str
());
}
}
PayloadEntryProxy
::
operator
double
()
PayloadEntryProxy
::
operator
double
()
{
{
return
atof
(
operator
std
::
string
().
c_str
());
return
boost
::
lexical_cast
<
double
>
(
operator
std
::
string
().
c_str
());
}
}
//}}}
//}}}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment