nvidia-texture-tools/src/nvcore/TextReader.h

40 lines
747 B
C
Raw Normal View History

2010-05-27 23:18:08 +00:00
// This code is in the public domain -- Ignacio Casta<74>o <castano@gmail.com>
2007-04-17 08:49:19 +00:00
2010-05-27 23:18:08 +00:00
#pragma once
#ifndef NVCORE_TEXTREADER_H
#define NVCORE_TEXTREADER_H
2007-04-17 08:49:19 +00:00
2010-05-27 23:18:08 +00:00
#include "nvcore.h"
2010-03-16 22:35:20 +00:00
#include "Stream.h"
2010-05-27 23:18:08 +00:00
#include "Array.h"
2007-04-17 08:49:19 +00:00
namespace nv
{
2010-05-27 23:18:08 +00:00
/// Text reader.
class NVCORE_CLASS TextReader {
public:
/// Ctor.
TextReader(Stream * stream) : m_stream(stream), m_text(512) {
nvCheck(stream != NULL);
nvCheck(stream->isLoading());
}
char peek();
char read();
const char *readToEnd();
// Returns a temporary string.
const char * readLine();
private:
Stream * m_stream;
Array<char> m_text;
};
2007-04-17 08:49:19 +00:00
} // nv namespace
2010-05-27 23:18:08 +00:00
#endif // NVCORE_TEXTREADER_H