• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TTypeInfo类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中TTypeInfo的典型用法代码示例。如果您正苦于以下问题:C++ TTypeInfo类的具体用法?C++ TTypeInfo怎么用?C++ TTypeInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TTypeInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: SetDefault

void CContainerTypeInfo::Assign(TObjectPtr dst, TConstObjectPtr src,
                                ESerialRecursionMode how) const
{
    if (how == eShallowChildless) {
        SetDefault(dst); // clear destination container
        return;
    }
    CIterator idst;
    CConstIterator isrc;
    bool old_element = InitIterator(idst,dst);
    if ( InitIterator(isrc, src) ) {
        TTypeInfo elementType = GetElementType();
        do {
            TConstObjectPtr elementPtr = GetElementPtr(isrc);
            if (old_element) {
                elementType->Assign(GetElementPtr(idst), elementPtr, how);
                old_element = NextElement(idst);
            } else {
                AddElement(dst, elementPtr, how);
            }
        } while ( NextElement(isrc) );
    }
    if (old_element) {
        EraseAllElements(idst);
    }
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:26,代码来源:continfo.cpp


示例2: GetPointedType

TTypeInfo CPointerTypeInfo::GetRealDataTypeInfo(TConstObjectPtr object) const
{
    TTypeInfo dataTypeInfo = GetPointedType();
    if ( object )
        dataTypeInfo = dataTypeInfo->GetRealTypeInfo(object);
    return dataTypeInfo;
}
开发者ID:swuecho,项目名称:igblast,代码行数:7,代码来源:ptrinfo.cpp


示例3: while

CTypeInfo* CPointerTypeInfo::SetTag(
    CAsnBinaryDefs::TLongTag tag,
    CAsnBinaryDefs::ETagClass tagclass,CAsnBinaryDefs::ETagType tagtype)
{
    CParent::SetTag(tag, tagclass, tagtype);
    if (tagtype == CAsnBinaryDefs::eImplicit) {
        const CPointerTypeInfo *ptrtype = this;
        while (ptrtype) {
            TTypeInfo ptype = ptrtype->GetPointedType();
            ptrtype = dynamic_cast<const CPointerTypeInfo*>(ptype);
            if (ptrtype) {
                if (ptrtype->GetTagType() == CAsnBinaryDefs::eImplicit ||
                    !ptrtype->HasTag()) {
                    continue;
                }
                m_TagConstructed = CAsnBinaryDefs::eConstructed;
            } else {
                m_TagConstructed = ptype->GetTagConstructed();
            }
            break;
        }
    } else {
        m_TagConstructed = CAsnBinaryDefs::eConstructed;
    }
    return this;
}
开发者ID:swuecho,项目名称:igblast,代码行数:26,代码来源:ptrinfo.cpp


示例4: GetElementType

bool CContainerTypeInfo::Equals(TConstObjectPtr object1, TConstObjectPtr object2,
                                ESerialRecursionMode how) const
{
    if (how == eShallowChildless) {
        return true;
    }
    TTypeInfo elementType = GetElementType();
    CConstIterator i1, i2;
    if ( InitIterator(i1, object1) ) {
        if ( !InitIterator(i2, object2) )
            return false;
        if ( !elementType->Equals(GetElementPtr(i1),
                                  GetElementPtr(i2), how) )
            return false;
        while ( NextElement(i1) ) {
            if ( !NextElement(i2) )
                return false;
            if ( !elementType->Equals(GetElementPtr(i1),
                                      GetElementPtr(i2), how) )
                return false;
        }
        return !NextElement(i2);
    }
    else {
        return !InitIterator(i2, object2);
    }
}
开发者ID:svn2github,项目名称:ncbi_tk,代码行数:27,代码来源:continfo.cpp


示例5: _TRACE

void CObjectOStream::WritePointer(TConstObjectPtr objectPtr,
                                  TTypeInfo declaredTypeInfo)
{
    _TRACE("WritePointer("<<NStr::PtrToString(objectPtr)<<", "
           <<declaredTypeInfo->GetName()<<")");
    if ( objectPtr == 0 ) {
        _TRACE("WritePointer: "<<NStr::PtrToString(objectPtr)<<": null");
        WriteNullPointer();
        return;
    }
    TTypeInfo realTypeInfo = declaredTypeInfo->GetRealTypeInfo(objectPtr);
    if ( m_Objects ) {
        const CWriteObjectInfo* info =
            m_Objects->RegisterObject(objectPtr, realTypeInfo);
        if ( info ) {
            // old object
            WriteObjectReference(info->GetIndex());
            return;
        }
    }
    if ( declaredTypeInfo == realTypeInfo ) {
        _TRACE("WritePointer: "<<NStr::PtrToString(objectPtr)<<": new");
        WriteThis(objectPtr, realTypeInfo);
    }
    else {
        _TRACE("WritePointer: "<<NStr::PtrToString(objectPtr)<<
               ": new "<<realTypeInfo->GetName());
        WriteOther(objectPtr, realTypeInfo);
    }
}
开发者ID:swuecho,项目名称:igblast,代码行数:30,代码来源:objostr.cpp


示例6: FindRealTypeInfo

const CItemInfo* CItemsInfo::FindNextMandatory(const CItemInfo* info)
{
    if (!info->GetId().HasNotag()) {
        const CMemberInfo* mem = dynamic_cast<const CMemberInfo*>(info);
        if (mem && mem->Optional()) {
            return 0;
        }
        return info;
    }
    const CItemInfo* found = 0;
    TTypeInfo type = FindRealTypeInfo(info->GetTypeInfo());
    ETypeFamily family = type->GetTypeFamily();
    if (family == eTypeFamilyClass || family == eTypeFamilyChoice) {
        const CClassTypeInfoBase* classType =
            dynamic_cast<const CClassTypeInfoBase*>(type);
        _ASSERT(classType);
        const CItemsInfo& items = classType->GetItems();
        TMemberIndex i;
        const CItemInfo* found_first = 0;
        for (i = items.FirstIndex(); i <= items.LastIndex(); ++i) {

            const CItemInfo* item = classType->GetItems().GetItemInfo(i);
            ETypeFamily item_family = item->GetTypeInfo()->GetTypeFamily();
            if (item_family == eTypeFamilyPointer) {
                const CPointerTypeInfo* ptr =
                    dynamic_cast<const CPointerTypeInfo*>(item->GetTypeInfo());
                if (ptr) {
                    item_family = ptr->GetPointedType()->GetTypeFamily();
                }
            }
            if (item_family == eTypeFamilyContainer) {
                if (item->NonEmpty()) {
                    found = FindNextMandatory( item );
                }
            } else {
                found = FindNextMandatory( item );
            }
            if (family == eTypeFamilyClass) {
                if (found) {
                    return found;
                }
            } else {
                if (!found) {
                    // this is optional choice variant
                    return 0;
                }
                if (!found_first) {
                    found_first = found;
                }
            }
        }
        return found_first;
    }
    return found;
}
开发者ID:,项目名称:,代码行数:55,代码来源:


示例7: TopFrame

void CObjectOStreamXml::x_EndTypeNamespace(void)
{
    if (m_UseSchemaRef) {
        if (TopFrame().HasTypeInfo()) {
            TTypeInfo type = TopFrame().GetTypeInfo();
            if (type->HasNamespaceName()) {
                x_EndNamespace(type->GetNamespaceName());
            }
        }
    }
}
开发者ID:,项目名称:,代码行数:11,代码来源:


示例8: ITERATE

bool CTypesIteratorBase<Parent>::CanEnter(const CConstObjectInfo& object)
{
    if ( !CParent::CanEnter(object) )
        return false;
    TTypeInfo type = object.GetTypeInfo();
    ITERATE ( TTypeList, i, GetTypeList() ) {
        if ( type->MayContainType(*i) )
            return true;
    }
    return false;
}
开发者ID:swuecho,项目名称:igblast,代码行数:11,代码来源:iterator.cpp


示例9: NCBI_THROW

void CChoicePointerTypeInfo::SetPointerType(TTypeInfo base)
{
    m_NullPointerIndex = kEmptyChoice;

    if ( base->GetTypeFamily() != eTypeFamilyPointer )
        NCBI_THROW(CSerialException,eInvalidData,
                     "invalid argument: must be CPointerTypeInfo");
    const CPointerTypeInfo* ptrType =
        CTypeConverter<CPointerTypeInfo>::SafeCast(base);
    m_PointerTypeInfo = ptrType;

    if ( ptrType->GetPointedType()->GetTypeFamily() != eTypeFamilyClass )
        NCBI_THROW(CSerialException,eInvalidData,
                     "invalid argument: data must be CClassTypeInfo");
    const CClassTypeInfo* classType =
        CTypeConverter<CClassTypeInfo>::SafeCast(ptrType->GetPointedType());
    /* Do we really need it to be CObject???
    if ( !classType->IsCObject() )
        NCBI_THROW(CSerialException,eInvalidData,
                     "invalid argument:: choice ptr type must be CObject");
    */
    const CClassTypeInfo::TSubClasses* subclasses =
        classType->SubClasses();
    if ( !subclasses )
        return;

    TTypeInfo nullTypeInfo = CNullTypeInfo::GetTypeInfo();

    for ( CClassTypeInfo::TSubClasses::const_iterator i = subclasses->begin();
          i != subclasses->end(); ++i ) {
        TTypeInfo variantType = i->second.Get();
        if ( !variantType ) {
            // null
            variantType = nullTypeInfo;
        }
        AddVariant(i->first, 0, variantType)->SetSubClass();
        TMemberIndex index = GetVariants().LastIndex();
        if ( variantType == nullTypeInfo ) {
            if ( m_NullPointerIndex == kEmptyChoice )
                m_NullPointerIndex = index;
            else {
                ERR_POST_X(1, "double null");
            }
        }
        else {
            const type_info* id = &CTypeConverter<CClassTypeInfo>::SafeCast(variantType)->GetId();
            if ( !m_VariantsByType.insert(TVariantsByType::value_type(id, index)).second ) {
                NCBI_THROW(CSerialException,eInvalidData,
                           "conflict subclasses: "+variantType->GetName());
            }
        }
    }
}
开发者ID:swuecho,项目名称:igblast,代码行数:53,代码来源:choiceptr.cpp


示例10: GetPointedType

void CAliasTypeInfo::Assign(TObjectPtr dst, TConstObjectPtr src,
                            ESerialRecursionMode how) const
{
#if 1
    GetPointedType()->Assign(dst, src, how);
#else
    TConstObjectPtr data = GetObjectPointer(src);
    TTypeInfo type = GetRealDataTypeInfo(data);
    TObjectPtr object = GetObjectPointer(dst);
    type->Assign(object, data, how);
#endif
}
开发者ID:,项目名称:,代码行数:12,代码来源:


示例11: x_ProcessTypeNamespace

bool CObjectOStreamXml::x_ProcessTypeNamespace(TTypeInfo type)
{
    if (m_UseSchemaRef) {
        string nsName;
        if (type->HasNamespaceName()) {
            nsName = type->GetNamespaceName();
        } else if (m_NsPrefixes.empty()) {
            nsName = GetDefaultSchemaNamespace();
        }
        return x_BeginNamespace(nsName,type->GetNamespacePrefix());
    }
    return false;
}
开发者ID:,项目名称:,代码行数:13,代码来源:


示例12: WriteFileHeader

void CObjectOStreamAsn::WriteFileHeader(TTypeInfo type)
{
    if ( true || m_Output.ZeroIndentLevel() ) {
        WriteId(type->GetName());
        m_Output.PutString(" ::= ");
    }
}
开发者ID:,项目名称:,代码行数:7,代码来源:


示例13: CreateAnyTypeClass

 static TObjectPtr CreateAnyTypeClass(TTypeInfo objectType,
                                      CObjectMemoryPool* /*memoryPool*/)
     {
         size_t size = objectType->GetSize();
         TObjectPtr obj = new char[size];
         memset(obj, 0, size);
         return obj;
     }
开发者ID:swuecho,项目名称:igblast,代码行数:8,代码来源:blocktype.cpp


示例14: GetObjectPointer

void CPointerTypeInfo::Assign(TObjectPtr dst, TConstObjectPtr src,
                              ESerialRecursionMode how) const
{
    TConstObjectPtr data = GetObjectPointer(src);
    if ( how != eRecursive ) {
        SetObjectPointer(dst, how == eShallow ? (const_cast<void*>(data)) : 0);
    }
    else if ( data == 0) {
        SetObjectPointer(dst, 0);
    }
    else {
        TTypeInfo type = GetRealDataTypeInfo(data);
        TObjectPtr object = type->Create();
        type->Assign(object, data, how);
        SetObjectPointer(dst, object);
    }
}
开发者ID:swuecho,项目名称:igblast,代码行数:17,代码来源:ptrinfo.cpp


示例15: WriteExternalObject

void CObjectOStream::WriteExternalObject(TConstObjectPtr objectPtr,
                                         TTypeInfo typeInfo)
{
    _TRACE("CObjectOStream::WriteExternalObject(" <<
           NStr::PtrToString(objectPtr) << ", "
           << typeInfo->GetName() << ')');
    RegisterObject(objectPtr, typeInfo);
    WriteObject(objectPtr, typeInfo);
}
开发者ID:swuecho,项目名称:igblast,代码行数:9,代码来源:objostr.cpp


示例16: CParent

BEGIN_NCBI_SCOPE


CChoicePointerTypeInfo::CChoicePointerTypeInfo(TTypeInfo pointerType)
    : CParent(pointerType->GetSize(),
              "",
              TConstObjectPtr(0), &CVoidTypeFunctions::Create, typeid(bool),
              &GetPtrIndex, &SetPtrIndex, &ResetPtrIndex)
{
    SetPointerType(pointerType);
}
开发者ID:swuecho,项目名称:igblast,代码行数:11,代码来源:choiceptr.cpp


示例17: CopyWithHook

void CTypeInfoFunctions::CopyWithHook(CObjectStreamCopier& stream,
                                      TTypeInfo objectType)
{
    CCopyObjectHook* hook =
        objectType->m_CopyHookData.GetHook(stream.m_ObjectHookKey);
    if (!hook) {
        hook = objectType->m_CopyHookData.GetPathHook(stream.In());
    }
    if ( hook )
        hook->CopyObject(stream, objectType);
    else
        objectType->DefaultCopyData(stream);
}
开发者ID:,项目名称:,代码行数:13,代码来源:


示例18: GetPublicModuleName

static string GetPublicModuleName(TTypeInfo type)
{
    const string& s = type->GetModuleName();
    string name;
    for ( string::const_iterator i = s.begin(); i != s.end(); ++i ) {
        char c = *i;
        if ( !isalnum((unsigned char) c) )
            name += ' ';
        else
            name += c;
    }
    return name;
}
开发者ID:,项目名称:,代码行数:13,代码来源:


示例19: SkipWithHook

void CTypeInfoFunctions::SkipWithHook(CObjectIStream& stream,
                                      TTypeInfo objectType)
{
    CSkipObjectHook* hook =
        objectType->m_SkipHookData.GetHook(stream.m_ObjectSkipHookKey);
    if (!hook) {
        hook = objectType->m_SkipHookData.GetPathHook(stream);
    }
    if ( hook )
        hook->SkipObject(stream, objectType);
    else
        objectType->DefaultSkipData(stream);
}
开发者ID:,项目名称:,代码行数:13,代码来源:


示例20: x_WriteClassNamespace

void CObjectOStreamXml::x_WriteClassNamespace(TTypeInfo type)
{
    if (type->GetName().find(':') != string::npos) {
        return;
    }
    OpenTagEndBack();

    if (m_UseSchemaLoc) {
        m_Output.PutEol();
        m_Output.PutString("   ");
    }
    m_Output.PutString(" xmlns");
    if (!m_CurrNsPrefix.empty()) {
       m_Output.PutChar(':');
       m_Output.PutString(m_CurrNsPrefix);
    }
    m_Output.PutString("=\"");

    string ns_name( m_NsPrefixToName[m_CurrNsPrefix]);
    if (ns_name.empty()) {
        ns_name = GetDefaultSchemaNamespace();
    }
    m_Output.PutString(ns_name + "\"");

    if (m_UseSchemaLoc) {
        m_Output.PutEol();
        string xs_name("http://www.w3.org/2001/XMLSchema-instance");
        string xs_prefix("xs");
        if (m_NsNameToPrefix.find(xs_name) == m_NsNameToPrefix.end()) {
            for (char a='a';
                m_NsPrefixToName.find(xs_prefix) != m_NsPrefixToName.end(); ++a) {
                xs_prefix += a;
            }
            m_NsPrefixToName[xs_prefix] = xs_name;
            m_NsNameToPrefix[xs_name] = xs_prefix;
            m_Output.PutString("    xmlns:");
            m_Output.PutString(xs_prefix + "=\"");
            m_Output.PutString(xs_name + "\"");
            m_Output.PutEol();
            m_Output.PutString("    ");
            m_Output.PutString(xs_prefix);
            m_Output.PutString(":schemaLocation=\"");
            m_Output.PutString(ns_name + " ");
            m_Output.PutString(GetDTDFilePrefix() + GetModuleName(type));
            m_Output.PutString(".xsd\"");
            m_Output.PutEol();
        }
    }
    OpenTagEnd();
}
开发者ID:,项目名称:,代码行数:50,代码来源:



注:本文中的TTypeInfo类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TUNER_MODULE类代码示例发布时间:2022-05-31
下一篇:
C++ TType类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap