Browse Source

Manager+Util: Change enum class type from int to uint8_t (4 -> 1 byte)

master
Riyyi 2 years ago
parent
commit
b574a79dfe
  1. 3
      src/dotfile.h
  2. 5
      src/package.h
  3. 3
      src/util/argparser.cpp
  4. 5
      src/util/argparser.h
  5. 9
      src/util/json/job.h
  6. 3
      src/util/json/lexer.h
  7. 2
      src/util/json/parser.cpp
  8. 4
      src/util/json/value.h

3
src/dotfile.h

@ -7,6 +7,7 @@
#pragma once
#include <cstddef> // size_t
#include <cstdint> // uint8_t
#include <filesystem>
#include <functional> // function
#include <string>
@ -19,7 +20,7 @@ public:
Dotfile(s);
virtual ~Dotfile();
enum class SyncType {
enum class SyncType : uint8_t {
Add,
Pull,
Push,

5
src/package.h

@ -6,6 +6,7 @@
#pragma once
#include <cstdint> // uint8_t
#include <optional>
#include <string>
#include <vector>
@ -17,13 +18,13 @@ public:
Package(s);
virtual ~Package();
enum class Distro {
enum class Distro : uint8_t {
Unsupported,
Arch,
Debian,
};
enum class InstallType {
enum class InstallType : uint8_t {
Install,
AurInstall,
};

3
src/util/argparser.cpp

@ -6,6 +6,7 @@
#include <algorithm> // find_if
#include <cstddef> // size_t
#include <cstdint> // uint8_t
#include <cstdio> // printf
#include <cstring> // strcmp
#include <limits> // numeric_limits
@ -169,7 +170,7 @@ bool ArgParser::parseLongOption(std::string_view option, std::string_view next)
return false;
}
enum class ArgumentProvided {
enum class ArgumentProvided : uint8_t {
No,
DirectlyAfter,
Seperated,

5
src/util/argparser.h

@ -7,6 +7,7 @@
#pragma once
#include <cstddef> // size_t
#include <cstdint> // uint8_t
#include <functional> // function
#include <string>
#include <string_view>
@ -21,13 +22,13 @@ public:
ArgParser();
virtual ~ArgParser();
enum class Required {
enum class Required : uint8_t {
No,
Yes,
Optional,
};
enum class Error {
enum class Error : uint8_t {
None,
OptionInvalid, // For short options
OptionUnrecognized, // For long options

9
src/util/json/job.h

@ -21,15 +21,6 @@ public:
Job(std::string_view input);
virtual ~Job();
enum class Color {
None,
Info,
Warn,
Danger,
Success,
Comment,
};
Value fire();
void printErrorLine(Token token, const char* message);

3
src/util/json/lexer.h

@ -10,6 +10,7 @@
// https://www.rfc-editor.org/rfc/pdfrfc/rfc8259.txt.pdf
#include <cstddef> // size_t
#include <cstdint> // uint8_t
#include <string>
#include <vector>
@ -20,7 +21,7 @@ namespace Util::JSON {
class Job;
struct Token {
enum class Type {
enum class Type : uint8_t {
None,
BraceOpen, // {
BraceClose, // }

2
src/util/json/parser.cpp

@ -144,7 +144,7 @@ Value Parser::consumeNumber()
return nullptr;
}
enum class State {
enum class State : uint8_t {
Int,
Fraction,
Exponent

4
src/util/json/value.h

@ -7,7 +7,7 @@
#pragma once
#include <cstddef> // nullptr_t, size_t
#include <cstdint> // uint32_t
#include <cstdint> // uint8_t, uint32_t
#include <initializer_list>
#include <iostream> // istream, ostream
#include <string>
@ -29,7 +29,7 @@ private:
friend class Serializer;
public:
enum class Type {
enum class Type : uint8_t {
Null, // null (case sensitive!)
Bool, // true/false (case sensitive!)
Number, // 123

Loading…
Cancel
Save