Skip to content

Commit f6f4dbd

Browse files
committed
Line endings
1 parent 3e05889 commit f6f4dbd

File tree

1 file changed

+55
-55
lines changed

1 file changed

+55
-55
lines changed
Lines changed: 55 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,56 @@
1-
#pragma once
2-
3-
#include <pl/patterns/pattern.hpp>
4-
5-
namespace pl::ptrn {
6-
7-
class PatternUnsigned : public Pattern {
8-
public:
9-
PatternUnsigned(core::Evaluator *evaluator, u64 offset, size_t size, u32 line)
10-
: Pattern(evaluator, offset, size, line) { }
11-
12-
[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
13-
return std::unique_ptr<Pattern>(new PatternUnsigned(*this));
14-
}
15-
16-
[[nodiscard]] core::Token::Literal getValue() const override {
17-
u128 data = 0;
18-
this->getEvaluator()->readData(this->getOffset(), &data, this->getSize(), this->getSection());
19-
return transformValue(hlp::changeEndianess(data, this->getSize(), this->getEndian()));
20-
}
21-
22-
[[nodiscard]] std::string getFormattedName() const override {
23-
return this->getTypeName();
24-
}
25-
26-
[[nodiscard]] bool operator==(const Pattern &other) const override { return compareCommonProperties<decltype(*this)>(other); }
27-
28-
void accept(PatternVisitor &v) override {
29-
v.visit(*this);
30-
}
31-
32-
std::string formatDisplayValue() override {
33-
auto data = this->getValue().toUnsigned();
34-
return Pattern::callUserFormatFunc(this->getValue()).value_or(fmt::format("{:d}", data));
35-
}
36-
37-
[[nodiscard]] std::string toString() override {
38-
auto value = this->getValue();
39-
auto result = fmt::format("{:d}", value.toUnsigned());
40-
41-
return Pattern::callUserFormatFunc(value, true).value_or(result);
42-
}
43-
44-
std::vector<u8> getRawBytes() override {
45-
std::vector<u8> result;
46-
result.resize(this->getSize());
47-
48-
this->getEvaluator()->readData(this->getOffset(), result.data(), result.size(), this->getSection());
49-
if (this->getEndian() != std::endian::native)
50-
std::reverse(result.begin(), result.end());
51-
52-
return result;
53-
}
54-
};
55-
1+
#pragma once
2+
3+
#include <pl/patterns/pattern.hpp>
4+
5+
namespace pl::ptrn {
6+
7+
class PatternUnsigned : public Pattern {
8+
public:
9+
PatternUnsigned(core::Evaluator *evaluator, u64 offset, size_t size, u32 line)
10+
: Pattern(evaluator, offset, size, line) { }
11+
12+
[[nodiscard]] std::shared_ptr<Pattern> clone() const override {
13+
return std::unique_ptr<Pattern>(new PatternUnsigned(*this));
14+
}
15+
16+
[[nodiscard]] core::Token::Literal getValue() const override {
17+
u128 data = 0;
18+
this->getEvaluator()->readData(this->getOffset(), &data, this->getSize(), this->getSection());
19+
return transformValue(hlp::changeEndianess(data, this->getSize(), this->getEndian()));
20+
}
21+
22+
[[nodiscard]] std::string getFormattedName() const override {
23+
return this->getTypeName();
24+
}
25+
26+
[[nodiscard]] bool operator==(const Pattern &other) const override { return compareCommonProperties<decltype(*this)>(other); }
27+
28+
void accept(PatternVisitor &v) override {
29+
v.visit(*this);
30+
}
31+
32+
std::string formatDisplayValue() override {
33+
auto data = this->getValue().toUnsigned();
34+
return Pattern::callUserFormatFunc(this->getValue()).value_or(fmt::format("{:d}", data));
35+
}
36+
37+
[[nodiscard]] std::string toString() override {
38+
auto value = this->getValue();
39+
auto result = fmt::format("{:d}", value.toUnsigned());
40+
41+
return Pattern::callUserFormatFunc(value, true).value_or(result);
42+
}
43+
44+
std::vector<u8> getRawBytes() override {
45+
std::vector<u8> result;
46+
result.resize(this->getSize());
47+
48+
this->getEvaluator()->readData(this->getOffset(), result.data(), result.size(), this->getSection());
49+
if (this->getEndian() != std::endian::native)
50+
std::reverse(result.begin(), result.end());
51+
52+
return result;
53+
}
54+
};
55+
5656
}

0 commit comments

Comments
 (0)