summaryrefslogtreecommitdiffstats
path: root/src/FurnaceRecipe.h
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-06-26 17:11:40 +0200
committerMattes D <github@xoft.cz>2014-06-26 17:11:40 +0200
commit3216fbabfd188e298aaf3f455ae0d4b3614d0201 (patch)
tree4d869890c2f9152778f0c08d4b41134a0a2cf02e /src/FurnaceRecipe.h
parentMerged branch 'tonibm19/master'. (diff)
parentParenthesised comparison (diff)
downloadcuberite-3216fbabfd188e298aaf3f455ae0d4b3614d0201.tar
cuberite-3216fbabfd188e298aaf3f455ae0d4b3614d0201.tar.gz
cuberite-3216fbabfd188e298aaf3f455ae0d4b3614d0201.tar.bz2
cuberite-3216fbabfd188e298aaf3f455ae0d4b3614d0201.tar.lz
cuberite-3216fbabfd188e298aaf3f455ae0d4b3614d0201.tar.xz
cuberite-3216fbabfd188e298aaf3f455ae0d4b3614d0201.tar.zst
cuberite-3216fbabfd188e298aaf3f455ae0d4b3614d0201.zip
Diffstat (limited to 'src/FurnaceRecipe.h')
-rw-r--r--src/FurnaceRecipe.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/FurnaceRecipe.h b/src/FurnaceRecipe.h
index 2f91e9bcb..ab78b6051 100644
--- a/src/FurnaceRecipe.h
+++ b/src/FurnaceRecipe.h
@@ -41,6 +41,28 @@ public:
private:
void ClearRecipes(void);
+ /** Calls LOGWARN with the line, position, and error */
+ static void PrintParseError(unsigned int a_Line, size_t a_Position, const AString & a_CharactersMissing);
+
+ /** Reads a number from a string given, starting at a given position and ending at a delimiter given
+ Updates beginning position to the delimiter found + 1, and updates the value to the one read
+ If it encounters a substring that is not fully numeric, it will call SetParseError() and return false; the caller should abort processing
+ Otherwise, the function will return true
+ */
+ static bool ReadMandatoryNumber(AString::size_type & a_Begin, const AString & a_Delimiter, const AString & a_Text, unsigned int a_Line, int & a_Value, bool a_IsLastValue = false);
+
+ /** Reads two numbers from a string given, starting at a given position and ending at the first delimiter given, then again (with an updated position) until the second delimiter given
+ Updates beginning position to the second delimiter found + 1, and updates the values to the ones read
+ If it encounters a substring that is not fully numeric whilst reading the second value, it will call SetParseError() and return false; the caller should abort processing
+ If this happens whilst reading the first value, it will call ReadMandatoryNumber() with the appropriate position, as this may legitimately occur with the optional value and AString::find_first_of finding the incorrect delimiter. It will return the result of ReadMandatoryNumber()
+ True will be returned definitively for an optional value that is valid
+ */
+ static bool ReadOptionalNumbers(AString::size_type & a_Begin, const AString & a_DelimiterOne, const AString & a_DelimiterTwo, const AString & a_Text, unsigned int a_Line, int & a_ValueOne, int & a_ValueTwo, bool a_IsLastValue = false);
+
+ /** Uses std::all_of to determine if a string contains only digits */
+ static bool DoesStringContainOnlyNumbers(const AString & a_String);
+
+
struct sFurnaceRecipeState;
sFurnaceRecipeState * m_pState;
};