File: format.hpp

package info (click to toggle)
rgbds 1.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,164 kB
  • sloc: cpp: 19,048; asm: 6,208; yacc: 2,405; sh: 1,784; makefile: 213; ansic: 14
file content (33 lines) | stat: -rw-r--r-- 630 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// SPDX-License-Identifier: MIT

#ifndef RGBDS_ASM_FORMAT_HPP
#define RGBDS_ASM_FORMAT_HPP

#include <stddef.h>
#include <stdint.h>
#include <string>

class FormatSpec {
	int sign;
	bool exact;
	bool alignLeft;
	bool padZero;
	size_t width;
	bool hasFrac;
	size_t fracWidth;
	bool hasPrec;
	size_t precision;
	int type;
	bool parsed;

public:
	bool isValid() const { return !!type; }
	bool isParsed() const { return parsed; }

	size_t parseSpec(char const *spec);

	void appendString(std::string &str, std::string const &value) const;
	void appendNumber(std::string &str, uint32_t value) const;
};

#endif // RGBDS_ASM_FORMAT_HPP