summaryrefslogtreecommitdiff
path: root/lib/pmc_to_ptree.cpp
diff options
context:
space:
mode:
authorJosh Blum2013-06-13 19:40:16 -0700
committerJosh Blum2013-06-13 19:40:16 -0700
commitb2ca1a2f613dbcd0ae7b727ba8d1cb88f43a38b5 (patch)
tree8324f882a3a6a5d189b6b92d4e2ecf001dc93523 /lib/pmc_to_ptree.cpp
parent83b6efaef9e9c9ac428bc6b4ce6179ac577240e9 (diff)
downloadsandhi-b2ca1a2f613dbcd0ae7b727ba8d1cb88f43a38b5.tar.gz
sandhi-b2ca1a2f613dbcd0ae7b727ba8d1cb88f43a38b5.tar.bz2
sandhi-b2ca1a2f613dbcd0ae7b727ba8d1cb88f43a38b5.zip
gras: added missing vector conversions and PMC update
this fixes #98
Diffstat (limited to 'lib/pmc_to_ptree.cpp')
-rw-r--r--lib/pmc_to_ptree.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/lib/pmc_to_ptree.cpp b/lib/pmc_to_ptree.cpp
index 6565fa6..9030b9d 100644
--- a/lib/pmc_to_ptree.cpp
+++ b/lib/pmc_to_ptree.cpp
@@ -72,12 +72,29 @@ PMCC gras::ptree_to_pmc(const ptree &value, const std::type_info &hint)
ptree_to_pmc_try(std::string);
//determine number vector
- std::vector<long> vec;
- BOOST_FOREACH(const ptree::value_type &elem, value)
- {
- vec.push_back(elem.second.get_value<long>());
+ #define ptree_to_pmc_tryv(type) \
+ if (hint == typeid(std::vector<type>)) \
+ { \
+ std::vector<type> vec; \
+ BOOST_FOREACH(const ptree::value_type &elem, value) \
+ { \
+ vec.push_back(elem.second.get_value<type>()); \
+ } \
+ return PMC_M(vec); \
}
- return PMC_M(vec);
+ ptree_to_pmc_tryv(char);
+ ptree_to_pmc_tryv(signed char);
+ ptree_to_pmc_tryv(unsigned char);
+ ptree_to_pmc_tryv(signed short);
+ ptree_to_pmc_tryv(unsigned short);
+ ptree_to_pmc_tryv(signed int);
+ ptree_to_pmc_tryv(unsigned int);
+ ptree_to_pmc_tryv(signed long);
+ ptree_to_pmc_tryv(unsigned long);
+ ptree_to_pmc_tryv(signed long long);
+ ptree_to_pmc_tryv(unsigned long long);
+ ptree_to_pmc_tryv(float);
+ ptree_to_pmc_tryv(double);
//otherwise null -- will crap out
return PMC();