📄 objistrasn.hpp
字号:
/* * =========================================================================== * PRODUCTION $Log: objistrasn.hpp,v $ * PRODUCTION Revision 1000.3 2004/06/01 19:38:56 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.61 * PRODUCTION * =========================================================================== */#ifndef OBJISTRASN__HPP#define OBJISTRASN__HPP/* $Id: objistrasn.hpp,v 1000.3 2004/06/01 19:38:56 gouriano Exp $* ===========================================================================** PUBLIC DOMAIN NOTICE* National Center for Biotechnology Information** This software/database is a "United States Government Work" under the* terms of the United States Copyright Act. It was written as part of* the author's official duties as a United States Government employee and* thus cannot be copyrighted. This software/database is freely available* to the public for use. The National Library of Medicine and the U.S.* Government have not placed any restriction on its use or reproduction.** Although all reasonable efforts have been taken to ensure the accuracy* and reliability of the software and data, the NLM and the U.S.* Government do not and cannot warrant the performance or results that* may be obtained by using this software or data. The NLM and the U.S.* Government disclaim all warranties, express or implied, including* warranties of performance, merchantability or fitness for any particular* purpose.** Please cite the author in any work or product based on this material.** ===========================================================================** Author: Eugene Vasilchenko** File Description:* !!! PUT YOUR DESCRIPTION HERE !!!*/#include <corelib/ncbistd.hpp>#include <serial/objistr.hpp>#include <util/lightstr.hpp>/** @addtogroup ObjStreamSupport * * @{ */BEGIN_NCBI_SCOPEclass NCBI_XSERIAL_EXPORT CObjectIStreamAsn : public CObjectIStream{public: CObjectIStreamAsn(EFixNonPrint how = eFNP_Default); CObjectIStreamAsn(CNcbiIstream& in, EFixNonPrint how = eFNP_Default); CObjectIStreamAsn(CNcbiIstream& in, bool deleteIn, EFixNonPrint how = eFNP_Default); virtual string GetPosition(void) const; virtual string ReadFileHeader(void); virtual TEnumValueType ReadEnum(const CEnumeratedTypeValues& values); virtual void ReadNull(void); void ReadAnyContent(string& value); virtual void ReadAnyContentObject(CAnyContentObject& obj); virtual void SkipAnyContentObject(void); EFixNonPrint FixNonPrint(EFixNonPrint how) { EFixNonPrint tmp = m_FixMethod; m_FixMethod = how; return tmp; }protected: TObjectIndex ReadIndex(void); // action: read ID into local buffer // return: ID pointer and length // note: it is not zero ended CLightString ScanEndOfId(bool isId); CLightString ReadTypeId(char firstChar); CLightString ReadMemberId(char firstChar); CLightString ReadUCaseId(char firstChar); CLightString ReadLCaseId(char firstChar); CLightString ReadNumber(void); virtual bool ReadBool(void); virtual char ReadChar(void); virtual Int4 ReadInt4(void); virtual Uint4 ReadUint4(void); virtual Int8 ReadInt8(void); virtual Uint8 ReadUint8(void); virtual double ReadDouble(void); virtual void ReadString(string& s,EStringType type = eStringTypeVisible); void ReadStringValue(string& s, EFixNonPrint fix_method); void FixInput(size_t count, EFixNonPrint fix_method, size_t line); virtual void SkipBool(void); virtual void SkipChar(void); virtual void SkipSNumber(void); virtual void SkipUNumber(void); virtual void SkipFNumber(void); virtual void SkipString(EStringType type = eStringTypeVisible); virtual void SkipNull(void); virtual void SkipByteBlock(void);protected:#ifdef VIRTUAL_MID_LEVEL_IO virtual void ReadContainer(const CContainerTypeInfo* containerType, TObjectPtr containerPtr); virtual void SkipContainer(const CContainerTypeInfo* containerType); virtual void ReadClassSequential(const CClassTypeInfo* classType, TObjectPtr classPtr); virtual void ReadClassRandom(const CClassTypeInfo* classType, TObjectPtr classPtr); virtual void SkipClassSequential(const CClassTypeInfo* classType); virtual void SkipClassRandom(const CClassTypeInfo* classType); virtual void ReadChoice(const CChoiceTypeInfo* choiceType, TObjectPtr choicePtr); virtual void SkipChoice(const CChoiceTypeInfo* choiceType);#endif // low level I/O virtual void BeginContainer(const CContainerTypeInfo* containerType); virtual void EndContainer(void); virtual bool BeginContainerElement(TTypeInfo elementType); virtual void BeginClass(const CClassTypeInfo* classInfo); virtual void EndClass(void); virtual TMemberIndex BeginClassMember(const CClassTypeInfo* classType); virtual TMemberIndex BeginClassMember(const CClassTypeInfo* classType, TMemberIndex pos); virtual TMemberIndex BeginChoiceVariant(const CChoiceTypeInfo* choiceType); virtual void BeginBytes(ByteBlock& block); int GetHexChar(void); virtual size_t ReadBytes(ByteBlock& block, char* dst, size_t length); virtual void EndBytes(const ByteBlock& block); virtual void BeginChars(CharBlock& block); virtual size_t ReadChars(CharBlock& block, char* dst, size_t length);private: virtual EPointerType ReadPointerType(void); virtual TObjectIndex ReadObjectPointer(void); virtual string ReadOtherPointer(void); void SkipObjectData(void); void SkipObjectPointer(void); void SkipBlock(void);private: // low level methods char GetChar(void); char PeekChar(void); // parse methods char GetChar(bool skipWhiteSpace); char PeekChar(bool skipWhiteSpace); bool GetChar(char c, bool skipWhiteSpace = false); void Expect(char c, bool skipWhiteSpace = false); bool Expect(char charTrue, char charFalse, bool skipWhiteSpace = false); void ExpectString(const char* s, bool skipWhiteSpace = false); static bool FirstIdChar(char c); static bool IdChar(char c); void SkipEndOfLine(char c); char SkipWhiteSpace(void); char SkipWhiteSpaceAndGetChar(void); void SkipComments(void); void UnexpectedMember(const CLightString& id, const CItemsInfo& items); void BadStringChar(size_t startLine, char c); void UnendedString(size_t startLine); void AppendStringData(string& s, size_t count, EFixNonPrint fix_method, size_t line); void AppendLongStringData(string& s, size_t count, EFixNonPrint fix_method, size_t line); void StartBlock(void); bool NextElement(void); void EndBlock(void); TMemberIndex GetMemberIndex(const CClassTypeInfo* classType, const CLightString& id); TMemberIndex GetMemberIndex(const CClassTypeInfo* classType, const CLightString& id, const TMemberIndex pos); TMemberIndex GetChoiceIndex(const CChoiceTypeInfo* choiceType, const CLightString& id); bool m_BlockStart; EFixNonPrint m_FixMethod; // method of fixing non-printable chars};/* @} *///#include <objistrb.inl>END_NCBI_SCOPE#endif /* OBJISTRB__HPP *//* ---------------------------------------------------------------------------* $Log: objistrasn.hpp,v $* Revision 1000.3 2004/06/01 19:38:56 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.61** Revision 1.61 2004/04/30 13:28:40 gouriano* Remove obsolete function declarations** Revision 1.60 2004/03/05 20:28:37 gouriano* make it possible to skip unknown data fields** Revision 1.59 2003/11/26 19:59:38 vasilche* GetPosition() and GetDataFormat() methods now are implemented* in parent classes CObjectIStream and CObjectOStream to avoid* pure virtual method call in destructors.** Revision 1.58 2003/08/19 18:32:37 vasilche* Optimized reading and writing strings.* Avoid string reallocation when checking char values.* Try to reuse old string data when string reference counting is not working.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -