xterminhate Si vis pacem, para bellum. | Pour une application j'ai besoin de gérer en mémoire un simple buffer.
Je recherche donc une classe de base qui permet toutes les opérations courantes de std::string (insert, append, erase, size, ...etc) basée sur le type (unsigned char *) ou (void *).
Aujourd'hui, j'ai un code plus mal foutu qui reprend l'interface de std::string mais qui semble planter aléatoirement.
Code :
- class x_RawBuffer
- {
- public:
- x_RawBuffer();
- virtual ~x_RawBuffer();
- x_RawBuffer( const x_RawBuffer & );
- const x_RawBuffer & operator=( const x_RawBuffer & );
- const unsigned short GetContentLength() const;
- unsigned char * GetContent();
- const unsigned char * GetContentConst() const;
- void Append( const void *, const unsigned short & );
- void Append( const x_RawBuffer & );
- void Insert( const void *, const unsigned short & );
- void Insert( const x_RawBuffer & );
- void Erase( const unsigned short & );
- void Clear();
- void SetContent( const void *, const unsigned short & );
- x_RawBuffer SubContent( const unsigned short &, const unsigned short & ) const;
- void SubContent( void *, const unsigned short &, const unsigned short & ) const;
- protected:
- void Copy( const unsigned char *, unsigned char *, const unsigned short & );
- void CopyConst( const unsigned char *, unsigned char *, const unsigned short & ) const;
- void Resize( const unsigned short & );
- private:
- unsigned short nContentLength;
- unsigned char * pContent;
- };
|
Cordialement,
Xter. Message édité par xterminhate le 14-03-2004 à 18:22:04
|