Commit Graph

59 Commits (4af900376186826b398d3359cffe53e9e433b0ae)

Author SHA1 Message Date
BodgeMaster 4af9003761 Code style: I just decided to accept that float and double exist and that we can just assume they are 32 and 64 bits repectively.
This isn't going to run on an Arduino or anything like that anyway.
2022-08-04 07:47:24 +02:00
Milan Suman 704b440d5a lib/nbt: Add tag classes 2022-08-04 00:01:12 +05:30
BodgeMaster 5c73308934 Rename all headers from .h++ to .hpp
Idk why I did that in the first place. Probably bc hpp looks stupid.
But having a + in a file name bugs me just as much. And other ppl as well.
So I changed it.
2022-08-02 03:35:08 +02:00
BodgeMaster b59fe1857e lib/cli: minor refactoring to make things less confusing and nicer to use
I renamed "unpositional arguments" to "options" and "positional arguments" to "arguments".
This is intended to make the code more readable and easier to type out.
2022-08-02 03:16:54 +02:00
BodgeMaster 69f15e928a lib/cli: Add fields for a short description and additional usage information to the arguments parser
This is in preparation for building the help text generator.
2022-08-02 02:03:50 +02:00
BodgeMaster 28719072bb fix a compiler warning 2022-08-01 16:39:18 +02:00
Milan Suman 4f1ad714bd lib/nbt.cpp: Implement writeString function 2022-07-28 17:15:04 +05:30
BodgeMaster c9d6cf0b5e lib/cli: minor consistency changes 2022-07-21 09:39:45 +02:00
BodgeMaster db3b133f88 lib/cli: fix trailing incomplete unpositional arguments
The parser used to rely on the next iteration of the loop to detect
if an unpositional argument was missing its value, this has now been
fixed by adding an additional check on unpositional arguments waiting
for a value that detects if the end of the loop has been reached
2022-07-20 18:30:25 +02:00
BodgeMaster 2cc2543b2a lib/error: fix compiler error with g++11 or newer
This wasprobably a syntax error on my part.
2022-07-20 09:58:58 +02:00
Milan Suman b5312aeb58 lib/nbt: implement readString NBT helper function 2022-07-20 12:08:04 +05:30
Milan Suman 2f38636a27 lib/javacompat: implement exportJavaString 2022-07-20 10:38:55 +05:30
Milan Suman 0462756451 lib: rename java_string to javacompat 2022-07-20 08:44:56 +05:30
Milan Suman c1b6c3005f lib/java_string: fix end character issues 2022-07-20 08:39:29 +05:30
BodgeMaster 45538e156a lib/java_string: replace std::vector with std::string 2022-07-20 04:23:06 +02:00
BodgeMaster e184acde00 lib/java_string: rename functions
JavaCompat::importJavaFormatToString() → JavaCompat::importJavaString()
JavaCompat::exportStringToJavaFormat() → JavaCompat::exportJavaString()
2022-07-20 04:00:17 +02:00
Milan Suman 42336c560a Birthed an abomination, what the fuck 2022-07-18 12:13:10 +05:30
BodgeMaster 79f58a6242 lib/java_string: add placeholder functions 2022-07-17 13:02:45 +02:00
BodgeMaster 2cbf048f2e lib/cli: make flags return more accurate error codes
revealed by writing a test and it behaving differently from what I expected
2022-07-17 12:09:19 +02:00
BodgeMaster 4c3d2fdbbf lib/cli: ArgumentsParser constructor can accept both char** and const char** 2022-07-15 13:49:43 +02:00
BodgeMaster 82d611b984 lib/cli: various fixes
- argumentWaitingForValue was never reset after the value had been retrieved
- made it so the ArgumentsParser constructor can accept const char**
- correct usage of substr() and actually use the correct position in the first place
- fix a typo where I tried to dereference `this` with `-` instead of `->`
2022-07-15 11:21:18 +02:00
BodgeMaster f5b0b74f94 lib/cli: remove useless arguments from getters, remove useless getter getProgramName (made the string public instead) 2022-07-15 09:11:39 +02:00
BodgeMaster a1223ea4b9 Minor improvements and fixes.
test/nbt_helpers: add a headline to output
Build system: remove comma from array that I added bc I thought it was correct sytax, it wasn't
lib/cli: change argument order of PositionalArgument constructor to fit in with Flag and UnpositionalArgument
lib/cli: properly define what is private and what is public in the ArgumentsParser class
2022-07-15 08:54:09 +02:00
BodgeMaster 390087fc35 lib/cli: finish initial implementation
This should be all functionality that is needed for now.
The next step is building unit tests to check that everything works correctly.

Who am I kidding? There will most certainly be bugs in there given that this
code has been typed out without ever being run.
2022-07-14 04:57:48 +02:00
BodgeMaster a2084e296a lib/error: Remove ErrorOr<T>(bool) constructor
This allows ErrorOr<T> to be used for bool, as there would be conflicting
constructors otherwise.

Also, we have ErrorCodes::UNKNOWN now so, instead of `ErrorOr<T>(true)`,
`ErrorOr<T>(true, ErrorCodes::UNKNOWN)` can be used.
2022-07-14 03:58:13 +02:00
BodgeMaster e6f4884b60 lib/error: finally removed that useless cpp file 2022-07-14 03:16:58 +02:00
BodgeMaster 91f3dfaa5e lib/cli: Add a library for command line arguments parsing
This has the parser itself already implemented, all other functionality is still
missing. So are tests.

Yes, I’m making my own getopt. Let me.
2022-07-14 03:13:48 +02:00
BodgeMaster 7e049fcfd1 lib/error: rename and add error constants 2022-07-13 22:01:18 +02:00
Shwoomple 68484c6a20 NBT: Moar nbt helper functions. Add all functions in issue #18 except writeString 2022-07-06 18:28:02 +05:30
Shwoomple 847b73c6ae NBT: implement the overloaded writeInt8Array 2022-07-06 17:16:47 +05:30
Shwoomple b0ccc74409 NBT: Added writeInt8Array. 2022-07-06 16:27:32 +05:30
BodgeMaster 762ba7f089 NBT: add write helpers for float types 2022-07-04 19:43:31 +02:00
BodgeMaster 8c7be385ae NBT: add write helpers for int32 and int64 2022-07-04 18:29:38 +02:00
BodgeMaster 6d62d995df NBT: implement write helpers for int8 and int16 2022-07-04 18:03:40 +02:00
BodgeMaster 044593e081 NBT: add compiler errors to the endian specific sections 2022-07-02 16:41:54 +02:00
BodgeMaster 664632d111 NBT: add stub write helper functions 2022-07-02 02:08:32 +02:00
BodgeMaster 4f9577eb36 NBT: implement readFloat helpers 2022-07-01 21:15:18 +02:00
BodgeMaster 975cdd309d NBT: implement NBT::helper::readInt64Array 2022-06-30 11:02:30 +02:00
BodgeMaster edcf40d5a5 NBT: implement NBT::helper::readInt32Array 2022-06-30 10:45:12 +02:00
BodgeMaster c87c519bb5 NBT: implement NBT::helper::readInt8Array 2022-06-29 12:22:54 +02:00
BodgeMaster 71fab21dfb Error: add OVERRUN_ERROR 2022-06-29 11:32:33 +02:00
BodgeMaster d43ef67ed1 NBT: fix bug in readInt64, improve readability 2022-06-29 00:05:02 +02:00
BodgeMaster 7c12a92b2a NBT: implement the integer helper functions 2022-06-28 22:04:04 +02:00
BodgeMaster 4f760f44be NBT: Implement readInt8 helper closing #2 2022-06-28 16:58:31 +02:00
BodgeMaster 12e9533772 apparently that's not how cpp works (I stole it from somewhere lol) 2022-06-28 16:51:52 +02:00
BodgeMaster 8594f4cbb0 NBT: Fix ambiguity between int types and bool when calling the ErrorOr<> constructor 2022-06-28 16:13:33 +02:00
BodgeMaster 83d606a2c7 Error: Add error codes to ErrorOr<> and add constructors
This allows us to handle functions that can fail in multiple different ways
2022-06-28 16:01:39 +02:00
BodgeMaster 081035db32 expose helpers in the header, rename NBT::helpers to NBT::helper 2022-06-28 15:19:47 +02:00
BodgeMaster ab920a114b comply with code style guidelines, also minor fix to them 2022-06-28 14:25:32 +02:00
BodgeMaster 9b58d165c0 We have a suitable string type for UTF-8 now. 2022-06-27 18:15:01 +02:00