本文整理汇总了C++中UnitEmitter::mergeLitstr方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitEmitter::mergeLitstr方法的具体用法?C++ UnitEmitter::mergeLitstr怎么用?C++ UnitEmitter::mergeLitstr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitEmitter
的用法示例。
在下文中一共展示了UnitEmitter::mergeLitstr方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: merge_repo_auth_type
void merge_repo_auth_type(UnitEmitter& ue, RepoAuthType rat) {
using T = RepoAuthType::Tag;
switch (rat.tag()) {
case T::OptBool:
case T::OptInt:
case T::OptSStr:
case T::OptStr:
case T::OptDbl:
case T::OptRes:
case T::OptObj:
case T::Null:
case T::Cell:
case T::Ref:
case T::InitUnc:
case T::Unc:
case T::InitCell:
case T::InitGen:
case T::Gen:
case T::Uninit:
case T::InitNull:
case T::Bool:
case T::Int:
case T::Dbl:
case T::Res:
case T::SStr:
case T::Str:
case T::Obj:
return;
case T::OptSArr:
case T::OptArr:
case T::SArr:
case T::Arr:
// We don't need to merge the litstrs in the array, because rats
// in arrays in the array type table must be using global litstr
// ids. (As the array type table itself is not associated with
// any unit.)
return;
case T::OptSubObj:
case T::OptExactObj:
case T::SubObj:
case T::ExactObj:
ue.mergeLitstr(rat.clsName());
return;
}
}
示例2: make_repo_type
RepoAuthType make_repo_type(UnitEmitter& ue, const Type& t) {
using T = RepoAuthType::Tag;
if (t.strictSubtypeOf(TObj) || (is_opt(t) && t.strictSubtypeOf(TOptObj))) {
auto const dobj = dobj_of(t);
auto const tag =
is_opt(t)
? (dobj.type == DObj::Exact ? T::OptExactObj : T::OptSubObj)
: (dobj.type == DObj::Exact ? T::ExactObj : T::SubObj);
ue.mergeLitstr(dobj.cls.name());
return RepoAuthType { tag, dobj.cls.name() };
}
#define ASSERTT_OP(x) if (t.subtypeOf(T##x)) return RepoAuthType{T::x};
ASSERTT_OPS
#undef ASSERTT_OP
return RepoAuthType{};
}
示例3: encode_member_key
void encode_member_key(MemberKey mk, UnitEmitter& ue) {
ue.emitByte(mk.mcode);
switch (mk.mcode) {
case MEC: case MEL: case MPC: case MPL:
ue.emitIVA(mk.iva);
break;
case MEI:
ue.emitInt64(mk.int64);
break;
case MET: case MPT: case MQT:
ue.emitInt32(ue.mergeLitstr(mk.litstr));
break;
case MW:
// No immediate
break;
}
}
示例4: txn
void UnitRepoProxy::GetUnitLitstrsStmt
::get(UnitEmitter& ue) {
RepoTxn txn(m_repo);
if (!prepared()) {
std::stringstream ssSelect;
ssSelect << "SELECT litstrId,litstr FROM "
<< m_repo.table(m_repoId, "UnitLitstr")
<< " WHERE unitSn == @unitSn ORDER BY litstrId ASC;";
txn.prepare(*this, ssSelect.str());
}
RepoTxnQuery query(txn, *this);
query.bindInt64("@unitSn", ue.sn());
do {
query.step();
if (query.row()) {
Id litstrId; /**/ query.getId(0, litstrId);
StringData* litstr; /**/ query.getStaticString(1, litstr);
Id id UNUSED = ue.mergeLitstr(litstr);
ASSERT(id == litstrId);
}
} while (!query.done());
txn.commit();
}
示例5: encodeRAT
void encodeRAT(UnitEmitter& ue, RepoAuthType rat) {
using T = RepoAuthType::Tag;
switch (rat.tag()) {
case T::Uninit:
case T::InitNull:
case T::Null:
case T::Int:
case T::OptInt:
case T::Dbl:
case T::OptDbl:
case T::Res:
case T::OptRes:
case T::Bool:
case T::OptBool:
case T::SStr:
case T::OptSStr:
case T::Str:
case T::OptStr:
case T::SVec:
case T::OptSVec:
case T::Vec:
case T::OptVec:
case T::SDict:
case T::OptSDict:
case T::Dict:
case T::OptDict:
case T::SKeyset:
case T::OptSKeyset:
case T::Keyset:
case T::OptKeyset:
case T::Obj:
case T::OptObj:
case T::UncArrKey:
case T::ArrKey:
case T::OptUncArrKey:
case T::OptArrKey:
case T::InitUnc:
case T::Unc:
case T::InitCell:
case T::Cell:
case T::Ref:
case T::InitGen:
case T::Gen:
ue.emitByte(static_cast<uint8_t>(rat.tag()));
break;
case T::SArr:
case T::OptSArr:
case T::Arr:
case T::OptArr:
case T::SVArr:
case T::OptSVArr:
case T::VArr:
case T::OptVArr:
case T::SDArr:
case T::OptSDArr:
case T::DArr:
case T::OptDArr:
{
auto tagByte = static_cast<uint8_t>(rat.tag());
if (rat.hasArrData()) tagByte |= kRATArrayDataBit;
ue.emitByte(tagByte);
if (rat.hasArrData()) {
ue.emitInt32(rat.arrayId());
}
break;
}
case T::ExactObj:
case T::SubObj:
case T::OptExactObj:
case T::OptSubObj:
ue.emitByte(static_cast<uint8_t>(rat.tag()));
ue.emitInt32(ue.mergeLitstr(rat.clsName()));
break;
}
}