src/AttributeFinder.h
branchv_0
changeset 8 eb1ecb37c6b7
parent 4 d44ed75822e7
child 9 b4f29fb16159
equal deleted inserted replaced
7:8d73bff730a7 8:eb1ecb37c6b7
    32 
    32 
    33 namespace fs = std::filesystem;
    33 namespace fs = std::filesystem;
    34 using namespace relpipe::writer;
    34 using namespace relpipe::writer;
    35 
    35 
    36 class AttributeFinder {
    36 class AttributeFinder {
       
    37 protected:
       
    38 	fs::path currentFile;
       
    39 	string currentFileRaw;
    37 public:
    40 public:
    38 
    41 
    39 	/**
    42 	/**
    40 	 * Single requested fields might generate multiple attributes in the relation.
    43 	 * Single requested fields might generate multiple attributes in the relation.
    41 	 * But usually it is 1:1.
    44 	 * But usually it is 1:1.
    45 	virtual vector<AttributeMetadata> toMetadata(const RequestedField& field) = 0;
    48 	virtual vector<AttributeMetadata> toMetadata(const RequestedField& field) = 0;
    46 
    49 
    47 	/**
    50 	/**
    48 	 * Writing of the record for current file is starting.
    51 	 * Writing of the record for current file is starting.
    49 	 * Following writeField() calls are related to this file.
    52 	 * Following writeField() calls are related to this file.
    50 	 * @param file
    53 	 * @param file path to the file
       
    54 	 * @param fileRaw raw file name as it was on the input
    51 	 */
    55 	 */
    52 	virtual void startFile(const fs::path& file) = 0;
    56 	virtual void startFile(const fs::path& file, const string& fileRaw) {
       
    57 		currentFile = file;
       
    58 		currentFileRaw = fileRaw;
       
    59 	}
    53 
    60 
    54 	/**
    61 	/**
    55 	 * Writing of the record for current file is finished. All resources linked to this file should be released.
    62 	 * Writing of the record for current file is finished. All resources linked to this file should be released.
    56 	 */
    63 	 */
    57 	virtual void endFile() = 0;
    64 	virtual void endFile() {
       
    65 		currentFile.clear();
       
    66 		currentFileRaw.clear();
       
    67 	}
    58 
    68 
    59 	/**
    69 	/**
    60 	 * Writes field attribute(s). The attribute count must match with count of AttributeMetadata returned in toMetadata().
    70 	 * Writes field attribute(s). The attribute count must match with count of AttributeMetadata returned in toMetadata().
    61 	 * @param writer
    71 	 * @param writer
    62 	 * @param field
    72 	 * @param field