本文整理汇总了C++中irept::get_comments方法的典型用法代码示例。如果您正苦于以下问题:C++ irept::get_comments方法的具体用法?C++ irept::get_comments怎么用?C++ irept::get_comments使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类irept
的用法示例。
在下文中一共展示了irept::get_comments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: full_eq
bool full_eq(const irept &i1, const irept &i2)
{
#ifdef SHARING
if(i1.data==i2.data) return true;
#endif
if(i1.id()!=i2.id()) return false;
const irept::subt &i1_sub=i1.get_sub();
const irept::subt &i2_sub=i2.get_sub();
const irept::named_subt &i1_named_sub=i1.get_named_sub();
const irept::named_subt &i2_named_sub=i2.get_named_sub();
const irept::named_subt &i1_comments=i1.get_comments();
const irept::named_subt &i2_comments=i2.get_comments();
if(i1_sub.size() !=i2_sub.size()) return false;
if(i1_named_sub.size()!=i2_named_sub.size()) return false;
if(i1_comments.size() !=i2_comments.size()) return false;
for(unsigned i=0; i<i1_sub.size(); i++)
if(!full_eq(i1_sub[i], i2_sub[i]))
return false;
{
irept::named_subt::const_iterator i1_it=i1_named_sub.begin();
irept::named_subt::const_iterator i2_it=i2_named_sub.begin();
for(; i1_it!=i1_named_sub.end(); i1_it++, i2_it++)
if(i1_it->first!=i2_it->first ||
!full_eq(i1_it->second, i2_it->second))
return false;
}
{
irept::named_subt::const_iterator i1_it=i1_comments.begin();
irept::named_subt::const_iterator i2_it=i2_comments.begin();
for(; i1_it!=i1_comments.end(); i1_it++, i2_it++)
if(i1_it->first!=i2_it->first ||
!full_eq(i1_it->second, i2_it->second))
return false;
}
return true;
}
示例2: convert_from_irep
/// To convert to JSON from an irep structure by recurssively generating JSON
/// for the different sub trees.
/// \param irep: The irep structure to turn into json
/// \param json: The json object to be filled up.
void json_irept::convert_from_irep(const irept &irep, jsont &json) const
{
json_objectt &irep_object=json.make_object();
if(irep.id()!=ID_nil)
irep_object["id"]=json_stringt(irep.id_string());
convert_sub_tree("sub", irep.get_sub(), irep_object);
convert_named_sub_tree("namedSub", irep.get_named_sub(), irep_object);
if(include_comments)
{
convert_named_sub_tree("comment", irep.get_comments(), irep_object);
}
}
示例3: pack
void irep_hash_container_baset::pack(
const irept &irep,
packedt &packed)
{
const irept::subt &sub=irep.get_sub();
const irept::named_subt &named_sub=irep.get_named_sub();
const irept::named_subt &comments=irep.get_comments();
packed.reserve(
1+1+sub.size()+named_sub.size()*2+
(full?comments.size()*2:0));
packed.push_back(irep_id_hash()(irep.id()));
packed.push_back(sub.size());
forall_irep(it, sub)
packed.push_back(number(*it));
packed.push_back(named_sub.size());
forall_named_irep(it, named_sub)
{
packed.push_back(irep_id_hash()(it->first)); // id
packed.push_back(number(it->second)); // sub-irep
}