added to TextStream:

TextStreamBase & operator<<(unsigned char);
  TextStreamBase & operator<<(bool);
  TextStreamBase & operator<<(short);
  TextStreamBase & operator<<(unsigned short);
  TextStreamBase & operator<<(float);
  TextStreamBase & operator<<(long double);
htmlparserlistener
Tomasz Sowa 2 years ago
parent 4d70ae9e87
commit 8b0ed5e750

@ -5,39 +5,30 @@
./convert/text.o: ./convert/text.h ./convert/text_private.h
./date/date.o: ./date/date.h convert/inttostr.h
./log/filelog.o: ./log/filelog.h textstream/textstream.h space/space.h
./log/filelog.o: textstream/types.h convert/inttostr.h date/date.h
./log/filelog.o: membuffer/membuffer.h textstream/types.h utf8/utf8.h
./log/filelog.o: utf8/utf8_templates.h utf8/utf8_private.h
./log/filelog.o: textstream/types.h convert/inttostr.h utf8/utf8.h
./log/filelog.o: utf8/utf8_templates.h utf8/utf8_private.h date/date.h
./log/filelog.o: membuffer/membuffer.h textstream/types.h
./log/log.o: ./log/log.h textstream/textstream.h space/space.h
./log/log.o: textstream/types.h convert/inttostr.h date/date.h
./log/log.o: textstream/types.h convert/inttostr.h utf8/utf8.h
./log/log.o: utf8/utf8_templates.h utf8/utf8_private.h date/date.h
./log/log.o: membuffer/membuffer.h textstream/types.h ./log/filelog.h
./log/log.o: utf8/utf8.h utf8/utf8_templates.h utf8/utf8_private.h
./space/space.o: ./space/space.h textstream/types.h convert/inttostr.h
./space/space.o: utf8/utf8.h textstream/textstream.h space/space.h
./space/space.o: date/date.h membuffer/membuffer.h textstream/types.h
./space/space.o: utf8/utf8_templates.h utf8/utf8_private.h convert/convert.h
./space/space.o: ./convert/inttostr.h convert/patternreplacer.h
./space/space.o: convert/strtoint.h ./convert/text.h ./convert/misc.h
./space/space.o: utf8/utf8.h utf8/utf8_templates.h utf8/utf8_private.h
./space/space.o: convert/convert.h ./convert/inttostr.h
./space/space.o: convert/patternreplacer.h textstream/textstream.h
./space/space.o: space/space.h date/date.h membuffer/membuffer.h
./space/space.o: textstream/types.h convert/strtoint.h ./convert/text.h
./space/space.o: ./convert/misc.h
./space/spaceparser.o: ./space/spaceparser.h ./space/space.h
./space/spaceparser.o: textstream/types.h convert/inttostr.h utf8/utf8.h
./space/spaceparser.o: textstream/textstream.h space/space.h date/date.h
./space/spaceparser.o: membuffer/membuffer.h textstream/types.h
./space/spaceparser.o: utf8/utf8_templates.h utf8/utf8_private.h
./space/spaceparser.o: convert/strtoint.h ./convert/text.h ./convert/misc.h
./utf8/utf8.o: ./utf8/utf8.h textstream/textstream.h space/space.h
./utf8/utf8.o: textstream/types.h convert/inttostr.h date/date.h
./utf8/utf8.o: membuffer/membuffer.h textstream/types.h utf8/utf8_templates.h
./utf8/utf8.o: utf8/utf8_private.h
./utf8/utf8_private.o: utf8/utf8_private.h textstream/textstream.h
./utf8/utf8_private.o: space/space.h textstream/types.h convert/inttostr.h
./utf8/utf8_private.o: date/date.h membuffer/membuffer.h textstream/types.h
./utf8/utf8.o: ./utf8/utf8.h utf8/utf8_templates.h utf8/utf8_private.h
./utf8/utf8_private.o: utf8/utf8_private.h
./csv/csvparser.o: ./csv/csvparser.h space/space.h textstream/types.h
./csv/csvparser.o: convert/inttostr.h utf8/utf8.h textstream/textstream.h
./csv/csvparser.o: date/date.h membuffer/membuffer.h textstream/types.h
./csv/csvparser.o: utf8/utf8_templates.h utf8/utf8_private.h
./csv/csvparser.o: convert/inttostr.h utf8/utf8.h utf8/utf8_templates.h
./csv/csvparser.o: utf8/utf8_private.h
./mainoptions/mainoptionsparser.o: ./mainoptions/mainoptionsparser.h
./mainoptions/mainoptionsparser.o: space/space.h textstream/types.h
./mainoptions/mainoptionsparser.o: convert/inttostr.h utf8/utf8.h
./mainoptions/mainoptionsparser.o: textstream/textstream.h date/date.h
./mainoptions/mainoptionsparser.o: membuffer/membuffer.h textstream/types.h
./mainoptions/mainoptionsparser.o: utf8/utf8_templates.h utf8/utf8_private.h

@ -44,9 +44,10 @@
#include <map>
#include <cstdio>
#include <cwchar>
#include <errno.h>
#include "textstream/types.h"
#include "convert/inttostr.h"
#include <errno.h>
#include "utf8/utf8.h"

@ -45,10 +45,10 @@
#include "membuffer/membuffer.h"
#include "types.h"
// for snprintf
#include <cstdio>
namespace pt
{
@ -96,18 +96,23 @@ public:
TextStreamBase & operator<<(const std::string & str);
TextStreamBase & operator<<(const wchar_t * str);
TextStreamBase & operator<<(const std::wstring * str);
TextStreamBase & operator<<(const std::wstring & str);
TextStreamBase & operator<<(char);
TextStreamBase & operator<<(unsigned char);
TextStreamBase & operator<<(wchar_t);
TextStreamBase & operator<<(bool);
TextStreamBase & operator<<(short);
TextStreamBase & operator<<(int);
TextStreamBase & operator<<(long);
TextStreamBase & operator<<(long long);
TextStreamBase & operator<<(unsigned short);
TextStreamBase & operator<<(unsigned int);
TextStreamBase & operator<<(unsigned long);
TextStreamBase & operator<<(unsigned long long);
TextStreamBase & operator<<(float);
TextStreamBase & operator<<(double);
TextStreamBase & operator<<(long double);
TextStreamBase & operator<<(const void *); // printing a pointer
TextStreamBase & operator<<(const Space & space);
TextStreamBase & operator<<(const Date & date);
@ -324,6 +329,16 @@ return *this;
}
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(unsigned char v)
{
buffer.append(static_cast<char_type>(v));
return *this;
}
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(wchar_t v)
@ -334,6 +349,25 @@ return *this;
}
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(bool v)
{
char c = v ? '1' : '0';
buffer.append(static_cast<char_type>(c));
return *this;
}
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(short v)
{
return operator<<(static_cast<long long>(v));
}
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(int v)
@ -368,6 +402,14 @@ return *this;
}
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(unsigned short v)
{
return operator<<(static_cast<unsigned long long>(v));
}
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(unsigned int v)
@ -402,6 +444,13 @@ return *this;
}
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(float v)
{
return operator<<(static_cast<double>(v));
}
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(double v)
@ -413,6 +462,17 @@ char buf[100];
}
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(long double v)
{
char buf[100];
snprintf(buf, sizeof(buf)/sizeof(char), "%Lf", v);
return operator<<(buf);
}
template<typename char_type, size_t stack_size, size_t heap_block_size>
TextStreamBase<char_type, stack_size, heap_block_size> &
TextStreamBase<char_type, stack_size, heap_block_size>::operator<<(const void * v)

@ -35,6 +35,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <fstream>
#include "utf8.h"
#include "utf8_private.h"

@ -39,7 +39,6 @@
#define headerfile_picotools_utf8_utf8
#include <string>
#include "textstream/textstream.h"
namespace pt

@ -38,7 +38,7 @@
#ifndef headerfile_picotools_utf8_utf8_private
#define headerfile_picotools_utf8_utf8_private
#include "textstream/textstream.h"
#include <string>
namespace pt
@ -186,15 +186,15 @@ void int_to_wide(int c, StreamType & res)
// not tested
// FIX ME it is not using surrogate pairs from input stream
// and mode parameter
template<typename char_type, size_t stack_size, size_t heap_block_size, typename function_type>
void wide_to_utf8_generic(TextStreamBase<char_type, stack_size, heap_block_size> & buffer, int mode, function_type write_function)
template<typename StreamType, typename function_type>
void wide_to_utf8_generic(StreamType & buffer, int mode, function_type write_function)
{
char utf8_buffer[256];
std::size_t buffer_len = sizeof(utf8_buffer) / sizeof(char);
std::size_t utf8_sequence_max_length = 10;
std::size_t index = 0;
typename TextStreamBase<char_type, stack_size, heap_block_size>::const_iterator i = buffer.begin();
typename StreamType::const_iterator i = buffer.begin();
while( i != buffer.end() )
{

@ -1,25 +1,29 @@
# DO NOT DELETE
./main.o: convert.h mainoptionsparser.h csvparser.h
./convert.o: convert.h test.h ../src/convert/convert.h
./convert.o: ../src/convert/inttostr.h ../src/convert/patternreplacer.h
./convert.o: ../src/textstream/textstream.h ../src/space/space.h
./convert.o: ../src/textstream/types.h ../src/convert/inttostr.h
./convert.o: ../src/date/date.h ../src/membuffer/membuffer.h
./convert.o: ../src/textstream/types.h ../src/convert/strtoint.h
./convert.o: ../src/convert/text.h ../src/convert/misc.h
./test.o: test.h
./convert.o: ../src/utf8/utf8.h ../src/utf8/utf8_templates.h
./convert.o: ../src/utf8/utf8_private.h ../src/date/date.h
./convert.o: ../src/membuffer/membuffer.h ../src/textstream/types.h
./convert.o: ../src/convert/strtoint.h ../src/convert/text.h
./convert.o: ../src/convert/misc.h
./csvparser.o: csvparser.h ../src/csv/csvparser.h ../src/space/space.h
./csvparser.o: ../src/textstream/types.h ../src/convert/inttostr.h
./csvparser.o: ../src/utf8/utf8.h ../src/utf8/utf8_templates.h
./csvparser.o: ../src/utf8/utf8_private.h test.h
./main.o: convert.h mainoptionsparser.h csvparser.h
./mainoptionsparser.o: mainoptionsparser.h test.h
./mainoptionsparser.o: ../src/mainoptions/mainoptionsparser.h
./mainoptionsparser.o: ../src/space/space.h ../src/textstream/types.h
./mainoptionsparser.o: ../src/convert/inttostr.h ../src/utf8/utf8.h
./mainoptionsparser.o: ../src/textstream/textstream.h ../src/date/date.h
./mainoptionsparser.o: ../src/membuffer/membuffer.h ../src/textstream/types.h
./mainoptionsparser.o: ../src/utf8/utf8_templates.h
./mainoptionsparser.o: ../src/utf8/utf8_private.h ../src/convert/convert.h
./mainoptionsparser.o: ../src/convert/inttostr.h
./mainoptionsparser.o: ../src/convert/patternreplacer.h
./mainoptionsparser.o: ../src/textstream/textstream.h ../src/date/date.h
./mainoptionsparser.o: ../src/membuffer/membuffer.h ../src/textstream/types.h
./mainoptionsparser.o: ../src/convert/strtoint.h ../src/convert/text.h
./mainoptionsparser.o: ../src/convert/misc.h
./csvparser.o: csvparser.h ../src/csv/csvparser.h ../src/space/space.h
./csvparser.o: ../src/textstream/types.h ../src/convert/inttostr.h test.h
./test.o: test.h

Loading…
Cancel
Save