本文整理汇总了C++中CObjectTypeInfo::FindMember方法的典型用法代码示例。如果您正苦于以下问题:C++ CObjectTypeInfo::FindMember方法的具体用法?C++ CObjectTypeInfo::FindMember怎么用?C++ CObjectTypeInfo::FindMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CObjectTypeInfo
的用法示例。
在下文中一共展示了CObjectTypeInfo::FindMember方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv)
{
// Create some ASN.1 data that can be parsed by this code sample.
char asn[] = "Date-std ::= { year 1998, month 1, day 2, season \"winter\" }";
// Setup an input stream, based on the sample ASN.1.
CNcbiIstrstream iss(asn);
unique_ptr<CObjectIStream> in(CObjectIStream::Open(eSerial_AsnText, iss));
////////////////////////////////////////////////////
// Create a hook for the 'year' class member of Date-std objects.
// The year class member was aribtrarily chosen to illustrate the
// use of hooks - many other entities would work equally well.
// Get data structures that model the type information for Date-std
// objects and their 'year' class members.
// The type information will be used to recognize and forward 'year'
// class members of Date-std objects found in the stream to the hook.
CObjectTypeInfo stdInfo = CType<CDate_std>();
CObjectTypeInfoMI memberInfo = stdInfo.FindMember("year");
// Set a local hook for Date-std 'year' class members. This involves
// creating an instance of the hook class and passing that hook to the
// "set hook" method, which registers the hook to be called when a hooked
// type is encountered in the stream.
memberInfo.SetLocalReadHook(*in, new CReadCMHook_Date_std__year());
// Read from the input stream, storing data in the object. At this point,
// the hook is in place so simply reading from the input stream will
// cause the hook to be triggered whenever the 'year' class member is
// encountered.
in->Read(stdInfo);
return 0;
}
示例2:
CObjectHookGuardBase::CObjectHookGuardBase(const CObjectTypeInfo& info,
const string& id,
CSkipClassMemberHook& hook,
CObjectIStream* stream)
: m_Hook(&hook),
m_HookMode(eHook_Skip),
m_HookType(eHook_Member),
m_Id(id)
{
m_Stream.m_IStream = stream;
CObjectTypeInfoMI member = info.FindMember(id);
if ( stream ) {
member.SetLocalSkipHook(*stream, &hook);
}
}
示例3: ResetHook
void CObjectHookGuardBase::ResetHook(const CObjectTypeInfo& info)
{
switch (m_HookType) {
case eHook_Object:
switch (m_HookMode) {
case eHook_Read:
if ( m_Stream.m_IStream ) {
info.ResetLocalReadHook(*m_Stream.m_IStream);
}
else {
info.ResetGlobalReadHook();
}
break;
case eHook_Write:
if ( m_Stream.m_OStream ) {
info.ResetLocalWriteHook(*m_Stream.m_OStream);
}
else {
info.ResetGlobalWriteHook();
}
break;
case eHook_Skip:
if ( m_Stream.m_IStream ) {
info.ResetLocalSkipHook(*m_Stream.m_IStream);
}
break;
case eHook_Copy:
if ( m_Stream.m_Copier ) {
info.ResetLocalCopyHook(*m_Stream.m_Copier);
}
else {
info.ResetGlobalCopyHook();
}
break;
default:
break;
}
break;
case eHook_Member:
{
CObjectTypeInfoMI member = info.FindMember(m_Id);
switch (m_HookMode) {
case eHook_Read:
if ( m_Stream.m_IStream ) {
member.ResetLocalReadHook(*m_Stream.m_IStream);
}
else {
member.ResetGlobalReadHook();
}
break;
case eHook_Write:
if ( m_Stream.m_OStream ) {
member.ResetLocalWriteHook(*m_Stream.m_OStream);
}
else {
member.ResetGlobalWriteHook();
}
break;
case eHook_Skip:
if ( m_Stream.m_IStream ) {
member.ResetLocalSkipHook(*m_Stream.m_IStream);
}
break;
case eHook_Copy:
if ( m_Stream.m_Copier ) {
member.ResetLocalCopyHook(*m_Stream.m_Copier);
}
else {
member.ResetGlobalCopyHook();
}
break;
default:
break;
}
break;
}
case eHook_Variant:
{
CObjectTypeInfoVI variant = info.FindVariant(m_Id);
switch (m_HookMode) {
case eHook_Read:
if ( m_Stream.m_IStream ) {
variant.ResetLocalReadHook(*m_Stream.m_IStream);
}
else {
variant.ResetGlobalReadHook();
}
break;
case eHook_Write:
if ( m_Stream.m_OStream ) {
variant.ResetLocalWriteHook(*m_Stream.m_OStream);
}
else {
variant.ResetGlobalWriteHook();
}
break;
case eHook_Skip:
if ( m_Stream.m_IStream ) {
variant.ResetLocalSkipHook(*m_Stream.m_IStream);
}
//.........这里部分代码省略.........