FOSSology  4.4.0
Open Source License Compliance by Open Source Software
FossologyUnicodeClean Class Reference

#include <FossologyUnicodeClean.hpp>

Collaboration diagram for FossologyUnicodeClean:
Collaboration graph

Public Member Functions

 FossologyUnicodeClean (std::string &source, std::string &destination)
 
virtual ~FossologyUnicodeClean ()
 
void startConvert ()
 

Private Member Functions

const std::string dirtyRead ()
 
void write (const icu::UnicodeString &output)
 Write the string to file/stream. More...
 
void flush ()
 Flush the buffers and reset the internal buffer. More...
 

Private Attributes

std::ifstream sourceFile
 
std::ofstream destinationFile
 
std::vector< icu::UnicodeString > buffer
 
size_t bufferSize
 
bool stopRead
 

Detailed Description

Class to remove non UTF-8 characters from file or steam and dump to another file or stream

Definition at line 31 of file FossologyUnicodeClean.hpp.

Constructor & Destructor Documentation

◆ FossologyUnicodeClean()

FossologyUnicodeClean::FossologyUnicodeClean ( std::string &  source,
std::string &  destination 
)

Constructor to open the input and output files (if passed). Also reserve the buffer in internal vector

Parameters
sourceSource file path (STDIN if empty)
destinationDestination file path (STDOUT if empty)

Definition at line 34 of file FossologyUnicodeClean.cc.

◆ ~FossologyUnicodeClean()

FossologyUnicodeClean::~FossologyUnicodeClean ( )
virtual

Destructor to flush the streams and close any open files.

Definition at line 15 of file FossologyUnicodeClean.cc.

Member Function Documentation

◆ dirtyRead()

const string FossologyUnicodeClean::dirtyRead ( )
private

Read raw input from file or STDIN

Returns
Raw string with MAX_LINE_READ characters.

Definition at line 89 of file FossologyUnicodeClean.cc.

◆ flush()

void FossologyUnicodeClean::flush ( )
private

Flush the buffers and reset the internal buffer.

Print the content of internal buffer to appropriate streams and flush them. Then clear the internal buffer and reset the size.

Definition at line 131 of file FossologyUnicodeClean.cc.

◆ startConvert()

void FossologyUnicodeClean::startConvert ( )

Start the process to read from file/stream -> remove invalid chars -> print to file/stream.

Definition at line 72 of file FossologyUnicodeClean.cc.

◆ write()

void FossologyUnicodeClean::write ( const icu::UnicodeString &  output)
private

Write the string to file/stream.

  • If the buffer is not filled, append to the buffer vector.
  • If the buffer is filled, call flush.
    Parameters
    output

Definition at line 115 of file FossologyUnicodeClean.cc.


The documentation for this class was generated from the following files: