clang format changes
This commit is contained in:
parent
3f14b084ff
commit
76e4c33345
@ -89,8 +89,7 @@ void EmitterState::StartedNode() {
|
|||||||
m_hasNonContent = false;
|
m_hasNonContent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitterNodeType::value EmitterState::NextGroupType(
|
EmitterNodeType::value EmitterState::NextGroupType(GroupType 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;
|
||||||
@ -220,8 +219,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 scope) {
|
||||||
FmtScope scope) {
|
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case EmitNonAscii:
|
case EmitNonAscii:
|
||||||
case EscapeNonAscii:
|
case EscapeNonAscii:
|
||||||
@ -257,8 +255,7 @@ bool EmitterState::SetBoolFormat(EMITTER_MANIP value, FmtScope scope) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetBoolLengthFormat(EMITTER_MANIP value,
|
bool EmitterState::SetBoolLengthFormat(EMITTER_MANIP value, FmtScope scope) {
|
||||||
FmtScope scope) {
|
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case LongBool:
|
case LongBool:
|
||||||
case ShortBool:
|
case ShortBool:
|
||||||
@ -269,8 +266,7 @@ bool EmitterState::SetBoolLengthFormat(EMITTER_MANIP value,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetBoolCaseFormat(EMITTER_MANIP value,
|
bool EmitterState::SetBoolCaseFormat(EMITTER_MANIP value, FmtScope scope) {
|
||||||
FmtScope scope) {
|
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case UpperCase:
|
case UpperCase:
|
||||||
case LowerCase:
|
case LowerCase:
|
||||||
@ -302,8 +298,7 @@ bool EmitterState::SetIndent(std::size_t value, FmtScope scope) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetPreCommentIndent(std::size_t value,
|
bool EmitterState::SetPreCommentIndent(std::size_t value, FmtScope scope) {
|
||||||
FmtScope scope) {
|
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -311,8 +306,7 @@ bool EmitterState::SetPreCommentIndent(std::size_t value,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetPostCommentIndent(std::size_t value,
|
bool EmitterState::SetPostCommentIndent(std::size_t value, FmtScope scope) {
|
||||||
FmtScope scope) {
|
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -359,8 +353,7 @@ bool EmitterState::SetFloatPrecision(std::size_t value, FmtScope scope) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EmitterState::SetDoublePrecision(std::size_t value,
|
bool EmitterState::SetDoublePrecision(std::size_t value, FmtScope 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,22 +18,11 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace YAML {
|
namespace YAML {
|
||||||
enum class FmtScope {
|
enum class FmtScope { Local, Global };
|
||||||
Local,
|
|
||||||
Global
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class GroupType {
|
enum class GroupType { NoType, Seq, Map };
|
||||||
NoType,
|
|
||||||
Seq,
|
|
||||||
Map
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class FlowType {
|
enum class FlowType { NoType, Flow, Block };
|
||||||
NoType,
|
|
||||||
Flow,
|
|
||||||
Block
|
|
||||||
};
|
|
||||||
|
|
||||||
class EmitterState {
|
class EmitterState {
|
||||||
public:
|
public:
|
||||||
@ -109,8 +98,7 @@ class EmitterState {
|
|||||||
bool SetPostCommentIndent(std::size_t value, FmtScope 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 groupType, EMITTER_MANIP value,
|
bool SetFlowType(GroupType groupType, EMITTER_MANIP value, FmtScope scope);
|
||||||
FmtScope scope);
|
|
||||||
EMITTER_MANIP GetFlowType(GroupType groupType) const;
|
EMITTER_MANIP GetFlowType(GroupType groupType) const;
|
||||||
|
|
||||||
bool SetMapKeyFormat(EMITTER_MANIP value, FmtScope scope);
|
bool SetMapKeyFormat(EMITTER_MANIP value, FmtScope scope);
|
||||||
|
|||||||
@ -261,9 +261,8 @@ bool WriteAliasName(ostream_wrapper& out, const std::string& str) {
|
|||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
StringFormat ComputeStringFormat(const std::string& str,
|
StringFormat ComputeStringFormat(const std::string& str,
|
||||||
EMITTER_MANIP strFormat,
|
EMITTER_MANIP strFormat, FlowType flowType,
|
||||||
FlowType flowType,
|
bool escapeNonAscii) {
|
||||||
bool escapeNonAscii) {
|
|
||||||
switch (strFormat) {
|
switch (strFormat) {
|
||||||
case Auto:
|
case Auto:
|
||||||
if (IsValidPlainScalar(str, flowType, escapeNonAscii)) {
|
if (IsValidPlainScalar(str, flowType, escapeNonAscii)) {
|
||||||
|
|||||||
@ -20,18 +20,12 @@ class ostream_wrapper;
|
|||||||
namespace YAML {
|
namespace YAML {
|
||||||
class Binary;
|
class Binary;
|
||||||
|
|
||||||
enum class StringFormat {
|
enum class StringFormat { Plain, SingleQuoted, DoubleQuoted, Literal };
|
||||||
Plain,
|
|
||||||
SingleQuoted,
|
|
||||||
DoubleQuoted,
|
|
||||||
Literal
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace Utils {
|
namespace Utils {
|
||||||
StringFormat ComputeStringFormat(const std::string& str,
|
StringFormat ComputeStringFormat(const std::string& str,
|
||||||
EMITTER_MANIP strFormat,
|
EMITTER_MANIP strFormat, FlowType 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);
|
||||||
bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
|
bool WriteDoubleQuotedString(ostream_wrapper& out, const std::string& str,
|
||||||
@ -47,7 +41,7 @@ bool WriteTag(ostream_wrapper& out, const std::string& str, bool verbatim);
|
|||||||
bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix,
|
bool WriteTagWithPrefix(ostream_wrapper& out, const std::string& prefix,
|
||||||
const std::string& tag);
|
const std::string& tag);
|
||||||
bool WriteBinary(ostream_wrapper& out, const Binary& binary);
|
bool WriteBinary(ostream_wrapper& out, const Binary& binary);
|
||||||
}
|
} // namespace Utils
|
||||||
}
|
} // namespace YAML
|
||||||
|
|
||||||
#endif // EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
#endif // EMITTERUTILS_H_62B23520_7C8E_11DE_8A39_0800200C9A66
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user