本文整理汇总了C++中value::get_string方法的典型用法代码示例。如果您正苦于以下问题:C++ value::get_string方法的具体用法?C++ value::get_string怎么用?C++ value::get_string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类value
的用法示例。
在下文中一共展示了value::get_string方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: property_op
void namespaces::property_op(
property_mode mode, value const &id, value &data)
{
local_root_scope scope;
string name_ = id.to_string();
xmlChar const *name = (xmlChar const*) name_.c_str();
xmlChar *txt = 0;
if (mode != property_get && mode != property_delete) {
data = data.to_string();
txt = xmlStrdup((xmlChar const *) data.get_string().c_str());
}
switch (mode) {
case property_add:
if (xmlHashAddEntry(table, name, txt) != 0)
throw exception("Could not add entry to namespace hash table");
break;
case property_delete:
if (xmlHashRemoveEntry(table, name, xmlHashDeallocator(xmlFree)) != 0)
throw exception("Could not remove entry from namespace hash table");
break;
case property_set:
if (xmlHashUpdateEntry(table, name, txt, xmlHashDeallocator(xmlFree))!=0)
throw exception("Could not update entry in namespace hash table");
break;
case property_get:
break;
}
}
示例2: search_namespace_by_prefix
object node::search_namespace_by_prefix(value const &prefix_) {
local_root_scope scope;
xmlChar const *prefix = 0;
if (!prefix_.is_string() && !prefix_.is_undefined() && !prefix_.is_null())
throw exception("Could not search for non-string namespace prefix");
if (prefix_.is_string())
prefix = (xmlChar const *) prefix_.get_string().c_str();
xmlNsPtr ns = xmlSearchNs(ptr->doc, ptr, prefix);
return namespace_::create(ns);
}
示例3: write
void stream::write(value const &data) {
if (data.is_string()) {
string text = data.get_string();
char const *str = text.c_str();
streambuf_->sputn(text.c_str(), std::strlen(str));
} else if (data.is_object()) {
binary &b = flusspferd::get_native<binary>(data.get_object());
streambuf_->sputn((char const*) &b.get_data()[0], b.get_length());
} else {
throw exception("Cannot write non-object non-string value to Stream");
}
//TODO slow?
if (get_property("autoFlush").to_boolean())
flush();
}