mirror of
https://gitee.com/openharmony/arkcompiler_runtime_core
synced 2024-11-23 06:40:32 +00:00
Code fixed for performance
Signed-off-by: shixiaowei4 <shixiaowei4@huawei.com> Change-Id: I4baf4fffcc6c8fe23b7e13280699c8d07931d6e7
This commit is contained in:
parent
d0f7b0bc82
commit
deaff859fd
@ -216,8 +216,8 @@ module MetadataGen
|
||||
end
|
||||
|
||||
def arg_list(is_bool)
|
||||
args = ['std::string_view attribute']
|
||||
args << 'std::string_view value' if !is_bool
|
||||
args = ['const std::string_view &attribute']
|
||||
args << 'const std::string_view &value' if !is_bool
|
||||
args
|
||||
end
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
namespace panda::pandasm::extensions::ecmascript {
|
||||
|
||||
std::optional<Metadata::Error> RecordMetadata::Validate(std::string_view attribute) const
|
||||
std::optional<Metadata::Error> RecordMetadata::Validate(const std::string_view &attribute) const
|
||||
{
|
||||
if (attribute == "ecmascript.annotation") {
|
||||
if (HasAttribute(attribute)) {
|
||||
@ -35,7 +35,8 @@ std::optional<Metadata::Error> RecordMetadata::Validate(std::string_view attribu
|
||||
return pandasm::RecordMetadata::Validate(attribute);
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> RecordMetadata::Validate(std::string_view attribute, std::string_view value) const
|
||||
std::optional<Metadata::Error> RecordMetadata::Validate(const std::string_view &attribute,
|
||||
const std::string_view &value) const
|
||||
{
|
||||
if (attribute == "ecmascript.extends") {
|
||||
if (HasAttribute(attribute)) {
|
||||
@ -53,37 +54,40 @@ std::optional<Metadata::Error> RecordMetadata::Validate(std::string_view attribu
|
||||
return pandasm::RecordMetadata::Validate(attribute, value);
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> FieldMetadata::Validate(std::string_view attribute) const
|
||||
std::optional<Metadata::Error> FieldMetadata::Validate(const std::string_view &attribute) const
|
||||
{
|
||||
return pandasm::FieldMetadata::Validate(attribute);
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> FieldMetadata::Validate(std::string_view attribute, std::string_view value) const
|
||||
std::optional<Metadata::Error> FieldMetadata::Validate(const std::string_view &attribute,
|
||||
const std::string_view &value) const
|
||||
{
|
||||
return pandasm::FieldMetadata::Validate(attribute, value);
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> FunctionMetadata::Validate(std::string_view attribute) const
|
||||
std::optional<Metadata::Error> FunctionMetadata::Validate(const std::string_view &attribute) const
|
||||
{
|
||||
return pandasm::FunctionMetadata::Validate(attribute);
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> FunctionMetadata::Validate(std::string_view attribute, std::string_view value) const
|
||||
std::optional<Metadata::Error> FunctionMetadata::Validate(const std::string_view &attribute,
|
||||
const std::string_view &value) const
|
||||
{
|
||||
return pandasm::FunctionMetadata::Validate(attribute, value);
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> ParamMetadata::Validate(std::string_view attribute) const
|
||||
std::optional<Metadata::Error> ParamMetadata::Validate(const std::string_view &attribute) const
|
||||
{
|
||||
return pandasm::ParamMetadata::Validate(attribute);
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> ParamMetadata::Validate(std::string_view attribute, std::string_view value) const
|
||||
std::optional<Metadata::Error> ParamMetadata::Validate(const std::string_view &attribute,
|
||||
const std::string_view &value) const
|
||||
{
|
||||
return pandasm::ParamMetadata::Validate(attribute, value);
|
||||
}
|
||||
|
||||
void RecordMetadata::SetFlags(std::string_view attribute)
|
||||
void RecordMetadata::SetFlags(const std::string_view &attribute)
|
||||
{
|
||||
if (attribute == "ecmascript.annotation") {
|
||||
SetAccessFlags(GetAccessFlags() | ACC_ANNOTATION);
|
||||
@ -91,12 +95,12 @@ void RecordMetadata::SetFlags(std::string_view attribute)
|
||||
pandasm::RecordMetadata::SetFlags(attribute);
|
||||
}
|
||||
|
||||
void RecordMetadata::SetFlags(std::string_view attribute, std::string_view value)
|
||||
void RecordMetadata::SetFlags(const std::string_view &attribute, const std::string_view &value)
|
||||
{
|
||||
pandasm::RecordMetadata::SetFlags(attribute, value);
|
||||
}
|
||||
|
||||
void RecordMetadata::RemoveFlags(std::string_view attribute)
|
||||
void RecordMetadata::RemoveFlags(const std::string_view &attribute)
|
||||
{
|
||||
if (attribute == "ecmascript.annotation") {
|
||||
if ((GetAccessFlags() & ACC_ANNOTATION) != 0) {
|
||||
@ -106,67 +110,67 @@ void RecordMetadata::RemoveFlags(std::string_view attribute)
|
||||
pandasm::RecordMetadata::RemoveFlags(attribute);
|
||||
}
|
||||
|
||||
void RecordMetadata::RemoveFlags(std::string_view attribute, std::string_view value)
|
||||
void RecordMetadata::RemoveFlags(const std::string_view &attribute, const std::string_view &value)
|
||||
{
|
||||
pandasm::RecordMetadata::RemoveFlags(attribute, value);
|
||||
}
|
||||
|
||||
void FieldMetadata::SetFlags(std::string_view attribute)
|
||||
void FieldMetadata::SetFlags(const std::string_view &attribute)
|
||||
{
|
||||
pandasm::FieldMetadata::SetFlags(attribute);
|
||||
}
|
||||
|
||||
void FieldMetadata::SetFlags(std::string_view attribute, std::string_view value)
|
||||
void FieldMetadata::SetFlags(const std::string_view &attribute, const std::string_view &value)
|
||||
{
|
||||
pandasm::FieldMetadata::SetFlags(attribute, value);
|
||||
}
|
||||
|
||||
void FieldMetadata::RemoveFlags(std::string_view attribute)
|
||||
void FieldMetadata::RemoveFlags(const std::string_view &attribute)
|
||||
{
|
||||
pandasm::FieldMetadata::RemoveFlags(attribute);
|
||||
}
|
||||
|
||||
void FieldMetadata::RemoveFlags(std::string_view attribute, std::string_view value)
|
||||
void FieldMetadata::RemoveFlags(const std::string_view &attribute, const std::string_view &value)
|
||||
{
|
||||
pandasm::FieldMetadata::RemoveFlags(attribute, value);
|
||||
}
|
||||
|
||||
void FunctionMetadata::SetFlags(std::string_view attribute)
|
||||
void FunctionMetadata::SetFlags(const std::string_view &attribute)
|
||||
{
|
||||
pandasm::FunctionMetadata::SetFlags(attribute);
|
||||
}
|
||||
|
||||
void FunctionMetadata::SetFlags(std::string_view attribute, std::string_view value)
|
||||
void FunctionMetadata::SetFlags(const std::string_view &attribute, const std::string_view &value)
|
||||
{
|
||||
pandasm::FunctionMetadata::SetFlags(attribute, value);
|
||||
}
|
||||
|
||||
void FunctionMetadata::RemoveFlags(std::string_view attribute)
|
||||
void FunctionMetadata::RemoveFlags(const std::string_view &attribute)
|
||||
{
|
||||
pandasm::FunctionMetadata::RemoveFlags(attribute);
|
||||
}
|
||||
|
||||
void FunctionMetadata::RemoveFlags(std::string_view attribute, std::string_view value)
|
||||
void FunctionMetadata::RemoveFlags(const std::string_view &attribute, const std::string_view &value)
|
||||
{
|
||||
pandasm::FunctionMetadata::RemoveFlags(attribute, value);
|
||||
}
|
||||
|
||||
void ParamMetadata::SetFlags(std::string_view attribute)
|
||||
void ParamMetadata::SetFlags(const std::string_view &attribute)
|
||||
{
|
||||
pandasm::ParamMetadata::SetFlags(attribute);
|
||||
}
|
||||
|
||||
void ParamMetadata::SetFlags(std::string_view attribute, std::string_view value)
|
||||
void ParamMetadata::SetFlags(const std::string_view &attribute, const std::string_view &value)
|
||||
{
|
||||
pandasm::ParamMetadata::SetFlags(attribute, value);
|
||||
}
|
||||
|
||||
void ParamMetadata::RemoveFlags(std::string_view attribute)
|
||||
void ParamMetadata::RemoveFlags(const std::string_view &attribute)
|
||||
{
|
||||
pandasm::ParamMetadata::RemoveFlags(attribute);
|
||||
}
|
||||
|
||||
void ParamMetadata::RemoveFlags(std::string_view attribute, std::string_view value)
|
||||
void ParamMetadata::RemoveFlags(const std::string_view &attribute, const std::string_view &value)
|
||||
{
|
||||
pandasm::ParamMetadata::RemoveFlags(attribute, value);
|
||||
}
|
||||
|
@ -79,17 +79,17 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute) const override;
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute, std::string_view value) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute, const std::string_view &value) const override;
|
||||
|
||||
void SetFlags(std::string_view attribute) override;
|
||||
void SetFlags(const std::string_view &attribute) override;
|
||||
|
||||
void SetFlags(std::string_view attribute, std::string_view value) override;
|
||||
void SetFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute) override;
|
||||
void RemoveFlags(const std::string_view &attribute) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute, std::string_view value) override;
|
||||
void RemoveFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
};
|
||||
|
||||
class FieldMetadata : public pandasm::FieldMetadata {
|
||||
@ -125,17 +125,17 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute) const override;
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute, std::string_view value) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute, const std::string_view &value) const override;
|
||||
|
||||
void SetFlags(std::string_view attribute) override;
|
||||
void SetFlags(const std::string_view &attribute) override;
|
||||
|
||||
void SetFlags(std::string_view attribute, std::string_view value) override;
|
||||
void SetFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute) override;
|
||||
void RemoveFlags(const std::string_view &attribute) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute, std::string_view value) override;
|
||||
void RemoveFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
};
|
||||
|
||||
class FunctionMetadata : public pandasm::FunctionMetadata {
|
||||
@ -171,17 +171,17 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute) const override;
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute, std::string_view value) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute, const std::string_view &value) const override;
|
||||
|
||||
void SetFlags(std::string_view attribute) override;
|
||||
void SetFlags(const std::string_view &attribute) override;
|
||||
|
||||
void SetFlags(std::string_view attribute, std::string_view value) override;
|
||||
void SetFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute) override;
|
||||
void RemoveFlags(const std::string_view &attribute) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute, std::string_view value) override;
|
||||
void RemoveFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
};
|
||||
|
||||
class ParamMetadata : public pandasm::ParamMetadata {
|
||||
@ -217,17 +217,17 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute) const override;
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute, std::string_view value) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute, const std::string_view &value) const override;
|
||||
|
||||
void SetFlags(std::string_view attribute) override;
|
||||
void SetFlags(const std::string_view &attribute) override;
|
||||
|
||||
void SetFlags(std::string_view attribute, std::string_view value) override;
|
||||
void SetFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute) override;
|
||||
void RemoveFlags(const std::string_view &attribute) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute, std::string_view value) override;
|
||||
void RemoveFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
};
|
||||
|
||||
} // namespace panda::pandasm::extensions::ecmascript
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
namespace panda::pandasm {
|
||||
|
||||
std::optional<Metadata::Error> Metadata::ValidateSize(std::string_view value) const
|
||||
std::optional<Metadata::Error> Metadata::ValidateSize(const std::string_view &value) const
|
||||
{
|
||||
constexpr size_t SIZE = 10;
|
||||
|
||||
@ -45,7 +45,7 @@ bool ItemMetadata::IsForeign() const
|
||||
return GetAttribute("external");
|
||||
}
|
||||
|
||||
static panda::pandasm::Value::Type GetType(std::string_view value)
|
||||
static panda::pandasm::Value::Type GetType(const std::string_view &value)
|
||||
{
|
||||
using VType = panda::pandasm::Value::Type;
|
||||
static std::unordered_map<std::string_view, VType> types {
|
||||
@ -60,7 +60,7 @@ static panda::pandasm::Value::Type GetType(std::string_view value)
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static T ConvertFromString(std::string_view value, char **end)
|
||||
static T ConvertFromString(const std::string_view &value, char **end)
|
||||
{
|
||||
static_assert(std::is_integral_v<T>, "T must be integral type");
|
||||
|
||||
@ -85,31 +85,31 @@ static T ConvertFromString(std::string_view value, char **end)
|
||||
}
|
||||
|
||||
template <>
|
||||
int64_t ConvertFromString(std::string_view value, char **end)
|
||||
int64_t ConvertFromString(const std::string_view &value, char **end)
|
||||
{
|
||||
return static_cast<int64_t>(strtoll(value.data(), end, 0));
|
||||
}
|
||||
|
||||
template <>
|
||||
uint64_t ConvertFromString(std::string_view value, char **end)
|
||||
uint64_t ConvertFromString(const std::string_view &value, char **end)
|
||||
{
|
||||
return static_cast<uint64_t>(strtoull(value.data(), end, 0));
|
||||
}
|
||||
|
||||
template <>
|
||||
float ConvertFromString(std::string_view value, char **end)
|
||||
float ConvertFromString(const std::string_view &value, char **end)
|
||||
{
|
||||
return strtof(value.data(), end);
|
||||
}
|
||||
|
||||
template <>
|
||||
double ConvertFromString(std::string_view value, char **end)
|
||||
double ConvertFromString(const std::string_view &value, char **end)
|
||||
{
|
||||
return strtod(value.data(), end);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static Expected<T, Metadata::Error> ConvertFromString(std::string_view value)
|
||||
static Expected<T, Metadata::Error> ConvertFromString(const std::string_view &value)
|
||||
{
|
||||
static_assert(std::is_arithmetic_v<T>, "T must be arithmetic type");
|
||||
|
||||
@ -129,7 +129,7 @@ static Expected<T, Metadata::Error> ConvertFromString(std::string_view value)
|
||||
}
|
||||
|
||||
template <Value::Type type, class T = ValueTypeHelperT<type>>
|
||||
static Expected<ScalarValue, Metadata::Error> CreatePrimitiveValue(std::string_view value,
|
||||
static Expected<ScalarValue, Metadata::Error> CreatePrimitiveValue(const std::string_view &value,
|
||||
T max_value = std::numeric_limits<T>::max())
|
||||
{
|
||||
auto res = ConvertFromString<T>(value);
|
||||
@ -147,7 +147,7 @@ static Expected<ScalarValue, Metadata::Error> CreatePrimitiveValue(std::string_v
|
||||
}
|
||||
|
||||
static Expected<ScalarValue, Metadata::Error> CreateValue(
|
||||
Value::Type type, std::string_view value,
|
||||
Value::Type type, const std::string_view &value,
|
||||
const std::unordered_map<std::string, std::unique_ptr<AnnotationData>> &annotation_id_map = {})
|
||||
{
|
||||
switch (type) {
|
||||
@ -236,7 +236,7 @@ std::optional<Metadata::Error> AnnotationMetadata::AnnotationElementBuilder::Add
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> AnnotationMetadata::Store(std::string_view attribute)
|
||||
std::optional<Metadata::Error> AnnotationMetadata::Store(const std::string_view &attribute)
|
||||
{
|
||||
if (IsParseAnnotationElement() && !annotation_element_builder_.IsCompleted()) {
|
||||
return Error(std::string("Unexpected attribute '").append(attribute) +
|
||||
@ -251,7 +251,7 @@ std::optional<Metadata::Error> AnnotationMetadata::Store(std::string_view attrib
|
||||
return Metadata::Store(attribute);
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> AnnotationMetadata::MeetExpRecordAttribute(std::string_view attribute,
|
||||
std::optional<Metadata::Error> AnnotationMetadata::MeetExpRecordAttribute(const std::string_view &attribute,
|
||||
const std::string_view &value)
|
||||
{
|
||||
if (IsParseAnnotationElement() && !annotation_element_builder_.IsCompleted()) {
|
||||
@ -265,7 +265,7 @@ std::optional<Metadata::Error> AnnotationMetadata::MeetExpRecordAttribute(std::s
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> AnnotationMetadata::MeetExpIdAttribute(std::string_view attribute,
|
||||
std::optional<Metadata::Error> AnnotationMetadata::MeetExpIdAttribute(const std::string_view &attribute,
|
||||
const std::string_view &value)
|
||||
{
|
||||
if (!IsParseAnnotation() || IsParseAnnotationElement()) {
|
||||
@ -285,7 +285,7 @@ std::optional<Metadata::Error> AnnotationMetadata::MeetExpIdAttribute(std::strin
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> AnnotationMetadata::MeetExpElementNameAttribute(std::string_view attribute,
|
||||
std::optional<Metadata::Error> AnnotationMetadata::MeetExpElementNameAttribute(const std::string_view &attribute,
|
||||
const std::string_view &value)
|
||||
{
|
||||
if (!IsParseAnnotation()) {
|
||||
@ -306,7 +306,7 @@ std::optional<Metadata::Error> AnnotationMetadata::MeetExpElementNameAttribute(s
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> AnnotationMetadata::MeetExpElementTypeAttribute(
|
||||
std::string_view attribute, const std::string_view &value)
|
||||
const std::string_view &attribute, const std::string_view &value)
|
||||
{
|
||||
if (!IsParseAnnotationElement()) {
|
||||
return Error(std::string("Unexpected attribute '").append(attribute) +
|
||||
@ -326,7 +326,7 @@ std::optional<Metadata::Error> AnnotationMetadata::MeetExpElementTypeAttribute(
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> AnnotationMetadata::MeetExpElementArrayComponentTypeAttribute(
|
||||
std::string_view attribute, const std::string_view &value)
|
||||
const std::string_view &attribute, const std::string_view &value)
|
||||
{
|
||||
if (!IsParseAnnotationElement()) {
|
||||
return Error(std::string("Unexpected attribute '").append(attribute) +
|
||||
@ -350,7 +350,7 @@ std::optional<Metadata::Error> AnnotationMetadata::MeetExpElementArrayComponentT
|
||||
return {};
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> AnnotationMetadata::MeetExpElementValueAttribute(std::string_view attribute,
|
||||
std::optional<Metadata::Error> AnnotationMetadata::MeetExpElementValueAttribute(const std::string_view &attribute,
|
||||
const std::string_view &value)
|
||||
{
|
||||
if (!IsParseAnnotationElement()) {
|
||||
@ -380,7 +380,8 @@ std::optional<Metadata::Error> AnnotationMetadata::MeetExpElementValueAttribute(
|
||||
return annotation_element_builder_.AddValue(value, id_map_);
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> AnnotationMetadata::StoreValue(std::string_view attribute, std::string_view value)
|
||||
std::optional<Metadata::Error> AnnotationMetadata::StoreValue(const std::string_view &attribute,
|
||||
const std::string_view &value)
|
||||
{
|
||||
auto err = Metadata::StoreValue(attribute, value);
|
||||
if (err) {
|
||||
@ -477,7 +478,8 @@ bool FunctionMetadata::IsCctor() const
|
||||
return GetAttribute("cctor");
|
||||
}
|
||||
|
||||
std::optional<Metadata::Error> FieldMetadata::StoreValue(std::string_view attribute, std::string_view value)
|
||||
std::optional<Metadata::Error> FieldMetadata::StoreValue(const std::string_view &attribute,
|
||||
const std::string_view &value)
|
||||
{
|
||||
auto err = ItemMetadata::StoreValue(attribute, value);
|
||||
if (err) {
|
||||
|
@ -146,11 +146,12 @@ public:
|
||||
DEFAULT_MOVE_SEMANTIC(Metadata);
|
||||
|
||||
protected:
|
||||
virtual std::optional<Error> Validate(std::string_view attribute) const = 0;
|
||||
virtual std::optional<Error> Validate(const std::string_view &attribute) const = 0;
|
||||
|
||||
virtual std::optional<Error> Validate(std::string_view attribute, std::string_view value) const = 0;
|
||||
virtual std::optional<Error> Validate(const std::string_view &attribute,
|
||||
const std::string_view &value) const = 0;
|
||||
|
||||
virtual std::optional<Error> StoreValue(std::string_view attribute, std::string_view value)
|
||||
virtual std::optional<Error> StoreValue(const std::string_view &attribute, const std::string_view &value)
|
||||
{
|
||||
std::string key(attribute);
|
||||
auto it = attributes_.find(key);
|
||||
@ -163,28 +164,28 @@ protected:
|
||||
return {};
|
||||
}
|
||||
|
||||
virtual std::optional<Error> Store(std::string_view attribute)
|
||||
virtual std::optional<Error> Store(const std::string_view &attribute)
|
||||
{
|
||||
set_attributes_.emplace(attribute);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
virtual void SetFlags(std::string_view attribute) = 0;
|
||||
virtual void SetFlags(const std::string_view &attribute) = 0;
|
||||
|
||||
virtual void SetFlags(std::string_view attribute, std::string_view value) = 0;
|
||||
virtual void SetFlags(const std::string_view &attribute, const std::string_view &value) = 0;
|
||||
|
||||
virtual void RemoveFlags(std::string_view attribute) = 0;
|
||||
virtual void RemoveFlags(const std::string_view &attribute) = 0;
|
||||
|
||||
virtual void RemoveFlags(std::string_view attribute, std::string_view value) = 0;
|
||||
virtual void RemoveFlags(const std::string_view &attribute, const std::string_view &value) = 0;
|
||||
|
||||
bool HasAttribute(std::string_view attribute) const
|
||||
bool HasAttribute(const std::string_view &attribute) const
|
||||
{
|
||||
std::string key(attribute);
|
||||
return GetAttribute(key) || GetAttributeValue(key);
|
||||
}
|
||||
|
||||
std::optional<Error> ValidateSize(std::string_view value) const;
|
||||
std::optional<Error> ValidateSize(const std::string_view &value) const;
|
||||
|
||||
private:
|
||||
std::unordered_set<std::string> set_attributes_;
|
||||
@ -217,9 +218,9 @@ public:
|
||||
std::optional<Error> ValidateData() override;
|
||||
|
||||
protected:
|
||||
std::optional<Error> Store(std::string_view attribute) override;
|
||||
std::optional<Error> Store(const std::string_view &attribute) override;
|
||||
|
||||
std::optional<Error> StoreValue(std::string_view attribute, std::string_view value) override;
|
||||
std::optional<Error> StoreValue(const std::string_view &attribute, const std::string_view &value) override;
|
||||
|
||||
virtual bool IsAnnotationRecordAttribute([[maybe_unused]] const std::string_view &attribute) const
|
||||
{
|
||||
@ -399,15 +400,16 @@ private:
|
||||
bool is_initialized_ {false};
|
||||
};
|
||||
|
||||
std::optional<Metadata::Error> MeetExpRecordAttribute(std::string_view attribute, const std::string_view &value);
|
||||
std::optional<Metadata::Error> MeetExpIdAttribute(std::string_view attribute, const std::string_view &value);
|
||||
std::optional<Metadata::Error> MeetExpElementNameAttribute(std::string_view attribute,
|
||||
std::optional<Metadata::Error> MeetExpRecordAttribute(const std::string_view &attribute,
|
||||
const std::string_view &value);
|
||||
std::optional<Metadata::Error> MeetExpIdAttribute(const std::string_view &attribute, const std::string_view &value);
|
||||
std::optional<Metadata::Error> MeetExpElementNameAttribute(const std::string_view &attribute,
|
||||
const std::string_view &value);
|
||||
std::optional<Metadata::Error> MeetExpElementTypeAttribute(std::string_view attribute,
|
||||
std::optional<Metadata::Error> MeetExpElementTypeAttribute(const std::string_view &attribute,
|
||||
const std::string_view &value);
|
||||
std::optional<Metadata::Error> MeetExpElementArrayComponentTypeAttribute(std::string_view attribute,
|
||||
std::optional<Metadata::Error> MeetExpElementArrayComponentTypeAttribute(const std::string_view &attribute,
|
||||
const std::string_view &value);
|
||||
std::optional<Metadata::Error> MeetExpElementValueAttribute(std::string_view attribute,
|
||||
std::optional<Metadata::Error> MeetExpElementValueAttribute(const std::string_view &attribute,
|
||||
const std::string_view &value);
|
||||
|
||||
void InitializeAnnotationBuilder(const std::string_view &name)
|
||||
@ -504,17 +506,17 @@ public:
|
||||
virtual bool IsRuntimeTypeAnnotation() const;
|
||||
|
||||
protected:
|
||||
std::optional<Error> Validate(std::string_view attribute) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute) const override;
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute, std::string_view value) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute, const std::string_view &value) const override;
|
||||
|
||||
void SetFlags(std::string_view attribute) override;
|
||||
void SetFlags(const std::string_view &attribute) override;
|
||||
|
||||
void SetFlags(std::string_view attribute, std::string_view value) override;
|
||||
void SetFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute) override;
|
||||
void RemoveFlags(const std::string_view &attribute) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute, std::string_view value) override;
|
||||
void RemoveFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
};
|
||||
|
||||
class FieldMetadata : public ItemMetadata {
|
||||
@ -540,21 +542,21 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
std::optional<Error> StoreValue(std::string_view attribute, std::string_view value) override;
|
||||
std::optional<Error> StoreValue(const std::string_view &attribute, const std::string_view &value) override;
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute) const override;
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute, std::string_view value) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute, const std::string_view &value) const override;
|
||||
|
||||
void SetFlags(std::string_view attribute) override;
|
||||
void SetFlags(const std::string_view &attribute) override;
|
||||
|
||||
void SetFlags(std::string_view attribute, std::string_view value) override;
|
||||
void SetFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute) override;
|
||||
void RemoveFlags(const std::string_view &attribute) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute, std::string_view value) override;
|
||||
void RemoveFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
|
||||
virtual bool IsValueAttribute(std::string_view attribute)
|
||||
virtual bool IsValueAttribute(const std::string_view &attribute)
|
||||
{
|
||||
return attribute == "value";
|
||||
}
|
||||
@ -571,32 +573,32 @@ public:
|
||||
virtual bool IsCctor() const;
|
||||
|
||||
protected:
|
||||
std::optional<Error> Validate(std::string_view attribute) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute) const override;
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute, std::string_view value) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute, const std::string_view &value) const override;
|
||||
|
||||
void SetFlags(std::string_view attribute) override;
|
||||
void SetFlags(const std::string_view &attribute) override;
|
||||
|
||||
void SetFlags(std::string_view attribute, std::string_view value) override;
|
||||
void SetFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute) override;
|
||||
void RemoveFlags(const std::string_view &attribute) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute, std::string_view value) override;
|
||||
void RemoveFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
};
|
||||
|
||||
class ParamMetadata : public AnnotationMetadata {
|
||||
protected:
|
||||
std::optional<Error> Validate(std::string_view attribute) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute) const override;
|
||||
|
||||
std::optional<Error> Validate(std::string_view attribute, std::string_view value) const override;
|
||||
std::optional<Error> Validate(const std::string_view &attribute, const std::string_view &value) const override;
|
||||
|
||||
void SetFlags(std::string_view attribute) override;
|
||||
void SetFlags(const std::string_view &attribute) override;
|
||||
|
||||
void SetFlags(std::string_view attribute, std::string_view value) override;
|
||||
void SetFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute) override;
|
||||
void RemoveFlags(const std::string_view &attribute) override;
|
||||
|
||||
void RemoveFlags(std::string_view attribute, std::string_view value) override;
|
||||
void RemoveFlags(const std::string_view &attribute, const std::string_view &value) override;
|
||||
};
|
||||
|
||||
} // namespace panda::pandasm
|
||||
|
Loading…
Reference in New Issue
Block a user