Docs on the parsing functions

This commit is contained in:
Paul Ferrand 2019-12-18 11:19:10 +01:00
parent 2ed8e24ed0
commit 861ca52a1c

View file

@ -126,9 +126,67 @@ inline float ccSwitchedValue(const SfzCCArray& ccValues, const absl::optional<CC
*/
absl::optional<uint8_t> readNoteValue(const absl::string_view& value);
/**
* @brief From a source view, find the next sfz header and its members and
* return them, while updating the source by removing this header
* and members from the beginning. The function "consumes" the
* header and its members from the source if found.
*
* No check is made to see if the header is "valid" in the sfz sense.
* The output parameters are set only if the method returns true.
*
* @param source A source view; can be updated and shortened
* @param header An output view on the header, without the <>
* @param members An output view on the members, untrimmed
* @return true if a header was found
* @return false otherwise
*/
bool findHeader(absl::string_view& source, absl::string_view& header, absl::string_view& members);
/**
* @brief From a source view, find the next sfz member opcode and its value.
* Return them while updating the source by removing this opcode
* and value from the beginning. The function "consumes" the
* opcode from the source if one is found.
*
* No check is made to see if the opcode is "valid" in the sfz sense.
* The output parameters are set only if the method returns true.
*
* @param source A source view; can be updated and shortened
* @param opcode An output view on the opcode name
* @param value An output view on the opcode value
* @return true if an opcode was found
* @return false
*/
bool findOpcode(absl::string_view& source, absl::string_view& opcode, absl::string_view& value);
/**
* @brief Find an SFZ #define statement on a line and return the variable and value as views.
*
* This function assums that there is a single define per line and that the variable and value
* are separated by whitespace.
* The output parameters are set only if the method returns true.
*
* @param line The source line
* @param variable An output view on the define variable
* @param value An output view on the define value
* @return true If a define was found
* @return false
*/
bool findDefine(absl::string_view line, absl::string_view& variable, absl::string_view& value);
/**
* @brief Find an SFZ #include statement on a line and return included path.
*
* This function assums that there is a single include per line and that the
* include path is within quotes.
* The output parameter is set only if the method returns true.
*
* @param line The source line
* @param path The path, if found
* @return true If an include was found
* @return false
*/
bool findInclude(absl::string_view line, std::string& path);
} // namespace sfz