Fix clang declaration shadows a variable: using class enum instead of enum
This commit is contained in:
parent
ce056acab7
commit
7febba3990
@ -90,7 +90,7 @@ void EmitterState::StartedNode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
EmitterNodeType::value EmitterState::NextGroupType(
|
EmitterNodeType::value EmitterState::NextGroupType(
|
||||||
GroupType::value type) const {
|
GroupType type) const {
|
||||||
if (type == GroupType::Seq) {
|
if (type == GroupType::Seq) {
|
||||||
if (GetFlowType(type) == Block)
|
if (GetFlowType(type) == Block)
|
||||||
return EmitterNodeType::BlockSeq;
|
return EmitterNodeType::BlockSeq;
|
||||||
@ -125,7 +125,7 @@ void EmitterState::StartedScalar() {
|
|||||||
ClearModifiedSettings();
|
ClearModifiedSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitterState::StartedGroup(GroupType::value type) {
|
void EmitterState::StartedGroup(GroupType type) {
|
||||||
StartedNode();
|
StartedNode();
|
||||||
|
|
||||||
const std::size_t lastGroupIndent =
|
const std::size_t lastGroupIndent =
|
||||||
@ -152,7 +152,7 @@ void EmitterState::StartedGroup(GroupType::value type) {
|
|||||||
m_groups.push_back(std::move(pGroup));
|
m_groups.push_back(std::move(pGroup));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EmitterState::EndedGroup(GroupType::value type) {
|
void EmitterState::EndedGroup(GroupType type) {
|
||||||
if (m_groups.empty()) {
|
if (m_groups.empty()) {
|
||||||
if (type == GroupType::Seq) {
|
if (type == GroupType::Seq) {
|
||||||
return SetError(ErrorMsg::UNEXPECTED_END_SEQ);
|
return SetError(ErrorMsg::UNEXPECTED_END_SEQ);
|
||||||
@ -190,11 +190,11 @@ EmitterNodeType::value EmitterState::CurGroupNodeType() const {
|
|||||||
return m_groups.back()->NodeType();
|
return m_groups.back()->NodeType();
|
||||||
}
|
}
|
||||||
|
|
||||||
GroupType::value EmitterState::CurGroupType() const {
|
GroupType EmitterState::CurGroupType() const {
|
||||||
return m_groups.empty() ? GroupType::NoType : m_groups.back()->type;
|
return m_groups.empty() ? GroupType::NoType : m_groups.back()->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
FlowType::value EmitterState::CurGroupFlowType() const {
|
FlowType EmitterState::CurGroupFlowType() const {
|
||||||
return m_groups.empty() ? FlowType::NoType : m_groups.back()->flowType;
|
return m_groups.empty() ? FlowType::NoType : m_groups.back()->flowType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,7 +221,7 @@ std::size_t EmitterState::LastIndent() const {
|
|||||||
void EmitterState::ClearModifiedSettings() { m_modifiedSettings.clear(); }
|
void EmitterState::ClearModifiedSettings() { m_modifiedSettings.clear(); }
|
||||||
|
|
||||||
bool EmitterState::SetOutputCharset(EMITTER_MANIP value,
|
bool EmitterState::SetOutputCharset(EMITTER_MANIP value,
|
||||||
FmtScope::value scope) {
|
FmtScope scope) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case EmitNonAscii:
|
case EmitNonAscii:
|
||||||
case EscapeNonAscii:
|
case EscapeNonAscii:
|
||||||
@ -232,7 +232,7 @@ bool EmitterState::SetOutputCharset(EMITTER_MANIP value,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetStringFormat(EMITTER_MANIP value, FmtScope::value scope) {
|
bool EmitterState::SetStringFormat(EMITTER_MANIP value, FmtScope scope) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case Auto:
|
case Auto:
|
||||||
case SingleQuoted:
|
case SingleQuoted:
|
||||||
@ -245,7 +245,7 @@ bool EmitterState::SetStringFormat(EMITTER_MANIP value, FmtScope::value scope) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetBoolFormat(EMITTER_MANIP value, FmtScope::value scope) {
|
bool EmitterState::SetBoolFormat(EMITTER_MANIP value, FmtScope scope) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case OnOffBool:
|
case OnOffBool:
|
||||||
case TrueFalseBool:
|
case TrueFalseBool:
|
||||||
@ -258,7 +258,7 @@ bool EmitterState::SetBoolFormat(EMITTER_MANIP value, FmtScope::value scope) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetBoolLengthFormat(EMITTER_MANIP value,
|
bool EmitterState::SetBoolLengthFormat(EMITTER_MANIP value,
|
||||||
FmtScope::value scope) {
|
FmtScope scope) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case LongBool:
|
case LongBool:
|
||||||
case ShortBool:
|
case ShortBool:
|
||||||
@ -270,7 +270,7 @@ bool EmitterState::SetBoolLengthFormat(EMITTER_MANIP value,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetBoolCaseFormat(EMITTER_MANIP value,
|
bool EmitterState::SetBoolCaseFormat(EMITTER_MANIP value,
|
||||||
FmtScope::value scope) {
|
FmtScope scope) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case UpperCase:
|
case UpperCase:
|
||||||
case LowerCase:
|
case LowerCase:
|
||||||
@ -282,7 +282,7 @@ bool EmitterState::SetBoolCaseFormat(EMITTER_MANIP value,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetIntFormat(EMITTER_MANIP value, FmtScope::value scope) {
|
bool EmitterState::SetIntFormat(EMITTER_MANIP value, FmtScope scope) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case Dec:
|
case Dec:
|
||||||
case Hex:
|
case Hex:
|
||||||
@ -294,7 +294,7 @@ bool EmitterState::SetIntFormat(EMITTER_MANIP value, FmtScope::value scope) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetIndent(std::size_t value, FmtScope::value scope) {
|
bool EmitterState::SetIndent(std::size_t value, FmtScope scope) {
|
||||||
if (value <= 1)
|
if (value <= 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -303,7 +303,7 @@ bool EmitterState::SetIndent(std::size_t value, FmtScope::value scope) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetPreCommentIndent(std::size_t value,
|
bool EmitterState::SetPreCommentIndent(std::size_t value,
|
||||||
FmtScope::value scope) {
|
FmtScope scope) {
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -312,7 +312,7 @@ bool EmitterState::SetPreCommentIndent(std::size_t value,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetPostCommentIndent(std::size_t value,
|
bool EmitterState::SetPostCommentIndent(std::size_t value,
|
||||||
FmtScope::value scope) {
|
FmtScope scope) {
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -320,8 +320,8 @@ bool EmitterState::SetPostCommentIndent(std::size_t value,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetFlowType(GroupType::value groupType, EMITTER_MANIP value,
|
bool EmitterState::SetFlowType(GroupType groupType, EMITTER_MANIP value,
|
||||||
FmtScope::value scope) {
|
FmtScope scope) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case Block:
|
case Block:
|
||||||
case Flow:
|
case Flow:
|
||||||
@ -332,7 +332,7 @@ bool EmitterState::SetFlowType(GroupType::value groupType, EMITTER_MANIP value,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EMITTER_MANIP EmitterState::GetFlowType(GroupType::value groupType) const {
|
EMITTER_MANIP EmitterState::GetFlowType(GroupType groupType) const {
|
||||||
// force flow style if we're currently in a flow
|
// force flow style if we're currently in a flow
|
||||||
if (CurGroupFlowType() == FlowType::Flow)
|
if (CurGroupFlowType() == FlowType::Flow)
|
||||||
return Flow;
|
return Flow;
|
||||||
@ -341,7 +341,7 @@ EMITTER_MANIP EmitterState::GetFlowType(GroupType::value groupType) const {
|
|||||||
return (groupType == GroupType::Seq ? m_seqFmt.get() : m_mapFmt.get());
|
return (groupType == GroupType::Seq ? m_seqFmt.get() : m_mapFmt.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope) {
|
bool EmitterState::SetMapKeyFormat(EMITTER_MANIP value, FmtScope scope) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case Auto:
|
case Auto:
|
||||||
case LongKey:
|
case LongKey:
|
||||||
@ -352,7 +352,7 @@ bool EmitterState::SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetFloatPrecision(std::size_t value, FmtScope::value scope) {
|
bool EmitterState::SetFloatPrecision(std::size_t value, FmtScope scope) {
|
||||||
if (value > std::numeric_limits<float>::max_digits10)
|
if (value > std::numeric_limits<float>::max_digits10)
|
||||||
return false;
|
return false;
|
||||||
_Set(m_floatPrecision, value, scope);
|
_Set(m_floatPrecision, value, scope);
|
||||||
@ -360,7 +360,7 @@ bool EmitterState::SetFloatPrecision(std::size_t value, FmtScope::value scope) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetDoublePrecision(std::size_t value,
|
bool EmitterState::SetDoublePrecision(std::size_t value,
|
||||||
FmtScope::value scope) {
|
FmtScope scope) {
|
||||||
if (value > std::numeric_limits<double>::max_digits10)
|
if (value > std::numeric_limits<double>::max_digits10)
|
||||||
return false;
|
return false;
|
||||||
_Set(m_doublePrecision, value, scope);
|
_Set(m_doublePrecision, value, scope);
|
||||||
|
|||||||
@ -18,14 +18,21 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace YAML {
|
namespace YAML {
|
||||||
struct FmtScope {
|
enum class FmtScope {
|
||||||
enum value { Local, Global };
|
Local,
|
||||||
|
Global
|
||||||
};
|
};
|
||||||
struct GroupType {
|
|
||||||
enum value { NoType, Seq, Map };
|
enum class GroupType {
|
||||||
|
NoType,
|
||||||
|
Seq,
|
||||||
|
Map
|
||||||
};
|
};
|
||||||
struct FlowType {
|
|
||||||
enum value { NoType, Flow, Block };
|
enum class FlowType {
|
||||||
|
NoType,
|
||||||
|
Flow,
|
||||||
|
Block
|
||||||
};
|
};
|
||||||
|
|
||||||
class EmitterState {
|
class EmitterState {
|
||||||
@ -50,14 +57,14 @@ class EmitterState {
|
|||||||
void StartedDoc();
|
void StartedDoc();
|
||||||
void EndedDoc();
|
void EndedDoc();
|
||||||
void StartedScalar();
|
void StartedScalar();
|
||||||
void StartedGroup(GroupType::value type);
|
void StartedGroup(GroupType type);
|
||||||
void EndedGroup(GroupType::value type);
|
void EndedGroup(GroupType type);
|
||||||
|
|
||||||
EmitterNodeType::value NextGroupType(GroupType::value type) const;
|
EmitterNodeType::value NextGroupType(GroupType type) const;
|
||||||
EmitterNodeType::value CurGroupNodeType() const;
|
EmitterNodeType::value CurGroupNodeType() const;
|
||||||
|
|
||||||
GroupType::value CurGroupType() const;
|
GroupType CurGroupType() const;
|
||||||
FlowType::value CurGroupFlowType() const;
|
FlowType CurGroupFlowType() const;
|
||||||
std::size_t CurGroupIndent() const;
|
std::size_t CurGroupIndent() const;
|
||||||
std::size_t CurGroupChildCount() const;
|
std::size_t CurGroupChildCount() const;
|
||||||
bool CurGroupLongKey() const;
|
bool CurGroupLongKey() const;
|
||||||
@ -76,47 +83,47 @@ class EmitterState {
|
|||||||
// formatters
|
// formatters
|
||||||
void SetLocalValue(EMITTER_MANIP value);
|
void SetLocalValue(EMITTER_MANIP value);
|
||||||
|
|
||||||
bool SetOutputCharset(EMITTER_MANIP value, FmtScope::value scope);
|
bool SetOutputCharset(EMITTER_MANIP value, FmtScope scope);
|
||||||
EMITTER_MANIP GetOutputCharset() const { return m_charset.get(); }
|
EMITTER_MANIP GetOutputCharset() const { return m_charset.get(); }
|
||||||
|
|
||||||
bool SetStringFormat(EMITTER_MANIP value, FmtScope::value scope);
|
bool SetStringFormat(EMITTER_MANIP value, FmtScope scope);
|
||||||
EMITTER_MANIP GetStringFormat() const { return m_strFmt.get(); }
|
EMITTER_MANIP GetStringFormat() const { return m_strFmt.get(); }
|
||||||
|
|
||||||
bool SetBoolFormat(EMITTER_MANIP value, FmtScope::value scope);
|
bool SetBoolFormat(EMITTER_MANIP value, FmtScope scope);
|
||||||
EMITTER_MANIP GetBoolFormat() const { return m_boolFmt.get(); }
|
EMITTER_MANIP GetBoolFormat() const { return m_boolFmt.get(); }
|
||||||
|
|
||||||
bool SetBoolLengthFormat(EMITTER_MANIP value, FmtScope::value scope);
|
bool SetBoolLengthFormat(EMITTER_MANIP value, FmtScope scope);
|
||||||
EMITTER_MANIP GetBoolLengthFormat() const { return m_boolLengthFmt.get(); }
|
EMITTER_MANIP GetBoolLengthFormat() const { return m_boolLengthFmt.get(); }
|
||||||
|
|
||||||
bool SetBoolCaseFormat(EMITTER_MANIP value, FmtScope::value scope);
|
bool SetBoolCaseFormat(EMITTER_MANIP value, FmtScope scope);
|
||||||
EMITTER_MANIP GetBoolCaseFormat() const { return m_boolCaseFmt.get(); }
|
EMITTER_MANIP GetBoolCaseFormat() const { return m_boolCaseFmt.get(); }
|
||||||
|
|
||||||
bool SetIntFormat(EMITTER_MANIP value, FmtScope::value scope);
|
bool SetIntFormat(EMITTER_MANIP value, FmtScope scope);
|
||||||
EMITTER_MANIP GetIntFormat() const { return m_intFmt.get(); }
|
EMITTER_MANIP GetIntFormat() const { return m_intFmt.get(); }
|
||||||
|
|
||||||
bool SetIndent(std::size_t value, FmtScope::value scope);
|
bool SetIndent(std::size_t value, FmtScope scope);
|
||||||
std::size_t GetIndent() const { return m_indent.get(); }
|
std::size_t GetIndent() const { return m_indent.get(); }
|
||||||
|
|
||||||
bool SetPreCommentIndent(std::size_t value, FmtScope::value scope);
|
bool SetPreCommentIndent(std::size_t value, FmtScope scope);
|
||||||
std::size_t GetPreCommentIndent() const { return m_preCommentIndent.get(); }
|
std::size_t GetPreCommentIndent() const { return m_preCommentIndent.get(); }
|
||||||
bool SetPostCommentIndent(std::size_t value, FmtScope::value scope);
|
bool SetPostCommentIndent(std::size_t value, FmtScope scope);
|
||||||
std::size_t GetPostCommentIndent() const { return m_postCommentIndent.get(); }
|
std::size_t GetPostCommentIndent() const { return m_postCommentIndent.get(); }
|
||||||
|
|
||||||
bool SetFlowType(GroupType::value groupType, EMITTER_MANIP value,
|
bool SetFlowType(GroupType groupType, EMITTER_MANIP value,
|
||||||
FmtScope::value scope);
|
FmtScope scope);
|
||||||
EMITTER_MANIP GetFlowType(GroupType::value groupType) const;
|
EMITTER_MANIP GetFlowType(GroupType groupType) const;
|
||||||
|
|
||||||
bool SetMapKeyFormat(EMITTER_MANIP value, FmtScope::value scope);
|
bool SetMapKeyFormat(EMITTER_MANIP value, FmtScope scope);
|
||||||
EMITTER_MANIP GetMapKeyFormat() const { return m_mapKeyFmt.get(); }
|
EMITTER_MANIP GetMapKeyFormat() const { return m_mapKeyFmt.get(); }
|
||||||
|
|
||||||
bool SetFloatPrecision(std::size_t value, FmtScope::value scope);
|
bool SetFloatPrecision(std::size_t value, FmtScope scope);
|
||||||
std::size_t GetFloatPrecision() const { return m_floatPrecision.get(); }
|
std::size_t GetFloatPrecision() const { return m_floatPrecision.get(); }
|
||||||
bool SetDoublePrecision(std::size_t value, FmtScope::value scope);
|
bool SetDoublePrecision(std::size_t value, FmtScope scope);
|
||||||
std::size_t GetDoublePrecision() const { return m_doublePrecision.get(); }
|
std::size_t GetDoublePrecision() const { return m_doublePrecision.get(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void _Set(Setting<T>& fmt, T value, FmtScope::value scope);
|
void _Set(Setting<T>& fmt, T value, FmtScope scope);
|
||||||
|
|
||||||
void StartedNode();
|
void StartedNode();
|
||||||
|
|
||||||
@ -144,7 +151,7 @@ class EmitterState {
|
|||||||
SettingChanges m_globalModifiedSettings;
|
SettingChanges m_globalModifiedSettings;
|
||||||
|
|
||||||
struct Group {
|
struct Group {
|
||||||
explicit Group(GroupType::value type_)
|
explicit Group(GroupType type_)
|
||||||
: type(type_),
|
: type(type_),
|
||||||
flowType{},
|
flowType{},
|
||||||
indent(0),
|
indent(0),
|
||||||
@ -152,8 +159,8 @@ class EmitterState {
|
|||||||
longKey(false),
|
longKey(false),
|
||||||
modifiedSettings{} {}
|
modifiedSettings{} {}
|
||||||
|
|
||||||
GroupType::value type;
|
GroupType type;
|
||||||
FlowType::value flowType;
|
FlowType flowType;
|
||||||
std::size_t indent;
|
std::size_t indent;
|
||||||
std::size_t childCount;
|
std::size_t childCount;
|
||||||
bool longKey;
|
bool longKey;
|
||||||
@ -188,7 +195,7 @@ class EmitterState {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void EmitterState::_Set(Setting<T>& fmt, T value, FmtScope::value scope) {
|
void EmitterState::_Set(Setting<T>& fmt, T value, FmtScope scope) {
|
||||||
switch (scope) {
|
switch (scope) {
|
||||||
case FmtScope::Local:
|
case FmtScope::Local:
|
||||||
m_modifiedSettings.push(fmt.set(value));
|
m_modifiedSettings.push(fmt.set(value));
|
||||||
|
|||||||
@ -151,7 +151,7 @@ void WriteCodePoint(ostream_wrapper& out, int codePoint) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsValidPlainScalar(const std::string& str, FlowType::value flowType,
|
bool IsValidPlainScalar(const std::string& str, FlowType flowType,
|
||||||
bool allowOnlyAscii) {
|
bool allowOnlyAscii) {
|
||||||
// check against null
|
// check against null
|
||||||
if (IsNullString(str)) {
|
if (IsNullString(str)) {
|
||||||
@ -210,7 +210,7 @@ bool IsValidSingleQuotedScalar(const std::string& str, bool escapeNonAscii) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsValidLiteralScalar(const std::string& str, FlowType::value flowType,
|
bool IsValidLiteralScalar(const std::string& str, FlowType flowType,
|
||||||
bool escapeNonAscii) {
|
bool escapeNonAscii) {
|
||||||
if (flowType == FlowType::Flow) {
|
if (flowType == FlowType::Flow) {
|
||||||
return false;
|
return false;
|
||||||
@ -262,7 +262,7 @@ bool WriteAliasName(ostream_wrapper& out, const std::string& str) {
|
|||||||
|
|
||||||
StringFormat::value ComputeStringFormat(const std::string& str,
|
StringFormat::value ComputeStringFormat(const std::string& str,
|
||||||
EMITTER_MANIP strFormat,
|
EMITTER_MANIP strFormat,
|
||||||
FlowType::value flowType,
|
FlowType flowType,
|
||||||
bool escapeNonAscii) {
|
bool escapeNonAscii) {
|
||||||
switch (strFormat) {
|
switch (strFormat) {
|
||||||
case Auto:
|
case Auto:
|
||||||
|
|||||||
@ -27,7 +27,7 @@ struct StringFormat {
|
|||||||
namespace Utils {
|
namespace Utils {
|
||||||
StringFormat::value ComputeStringFormat(const std::string& str,
|
StringFormat::value ComputeStringFormat(const std::string& str,
|
||||||
EMITTER_MANIP strFormat,
|
EMITTER_MANIP strFormat,
|
||||||
FlowType::value flowType,
|
FlowType flowType,
|
||||||
bool escapeNonAscii);
|
bool escapeNonAscii);
|
||||||
|
|
||||||
bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str);
|
bool WriteSingleQuotedString(ostream_wrapper& out, const std::string& str);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user