haiku/headers/private/storage/sniffer/CharStream.h
Coldfirex 2ca1376080 Mass updating of OpenBeOS text to Haiku
No functional code altered.

https://dev.haiku-os.org/ticket/17197

Change-Id: I75cc74f6be0ad968fd77c31fbe5b0f650a6fe9e0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4364
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
2021-11-07 10:00:35 +00:00

57 lines
1.2 KiB
C++

//----------------------------------------------------------------------
// This software is part of the Haiku distribution and is covered
// by the MIT License.
//---------------------------------------------------------------------
/*!
\file sniffer/CharStream.h
Character stream class
*/
#ifndef _SNIFFER_CHAR_STREAM_H
#define _SNIFFER_CHAR_STREAM_H
#include <SupportDefs.h>
#include <string>
namespace BPrivate {
namespace Storage {
namespace Sniffer {
//! Manages a stream of characters
/*! CharStream is used by the scanner portion of the parser, which is implemented
in TokenStream::SetTo().
It's also used by BPrivate::TRoster while parsing through the the
roster's RosterSettings file.
*/
class CharStream {
public:
CharStream(const std::string &string);
CharStream();
virtual ~CharStream();
status_t SetTo(const std::string &string);
void Unset();
status_t InitCheck() const;
bool IsEmpty() const;
size_t Pos() const;
const std::string& String() const;
char Get();
void Unget();
private:
std::string fString;
size_t fPos;
status_t fCStatus;
CharStream(const CharStream &ref);
CharStream& operator=(const CharStream &ref);
};
}; // namespace Sniffer
}; // namespace Storage
}; // namespace BPrivate
#endif // _SNIFFER_CHAR_STREAM_H