Skip to content

Commit 0c6832c

Browse files
committed
[clang-tidy] convert member functions to static
Found with readability-convert-member-functions-to-static Signed-off-by: Rosen Penev <[email protected]>
1 parent ef33e9c commit 0c6832c

File tree

4 files changed

+15
-28
lines changed

4 files changed

+15
-28
lines changed

include/yaml-cpp/emitter.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ class YAML_CPP_API Emitter {
123123
void SpaceOrIndentTo(bool requireSpace, std::size_t indent);
124124

125125
const char* ComputeFullBoolName(bool b) const;
126-
bool CanEmitNewline() const;
127126

128127
private:
129128
std::unique_ptr<EmitterState> m_pState;

src/emitter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,6 @@ void Emitter::EmitNewline() {
251251
m_pState->SetNonContent();
252252
}
253253

254-
bool Emitter::CanEmitNewline() const { return true; }
255-
256254
// Put the stream in a state so we can simply write the next node
257255
// E.g., if we're in a sequence, write the "- "
258256
void Emitter::PrepareNode(EmitterNodeType::value child) {

src/scanner.cpp

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,19 @@
66
#include "token.h"
77
#include "yaml-cpp/exceptions.h" // IWYU pragma: keep
88

9+
namespace {
10+
// IsWhitespaceToBeEaten
11+
// . We can eat whitespace if it's a space or tab
12+
// . Note: originally tabs in block context couldn't be eaten
13+
// "where a simple key could be allowed
14+
// (i.e., not at the beginning of a line, or following '-', '?', or
15+
// ':')"
16+
// I think this is wrong, since tabs can be non-content whitespace; it's just
17+
// that they can't contribute to indentation, so once you've seen a tab in a
18+
// line, you can't start a simple key
19+
bool IsWhitespaceToBeEaten(char ch) { return (ch == ' ') || (ch == '\t'); }
20+
} // namespace
21+
922
namespace YAML {
1023
Scanner::Scanner(std::istream& in)
1124
: INPUT(in),
@@ -213,27 +226,6 @@ void Scanner::ScanToNextToken() {
213226
///////////////////////////////////////////////////////////////////////
214227
// Misc. helpers
215228

216-
// IsWhitespaceToBeEaten
217-
// . We can eat whitespace if it's a space or tab
218-
// . Note: originally tabs in block context couldn't be eaten
219-
// "where a simple key could be allowed
220-
// (i.e., not at the beginning of a line, or following '-', '?', or
221-
// ':')"
222-
// I think this is wrong, since tabs can be non-content whitespace; it's just
223-
// that they can't contribute to indentation, so once you've seen a tab in a
224-
// line, you can't start a simple key
225-
bool Scanner::IsWhitespaceToBeEaten(char ch) {
226-
if (ch == ' ') {
227-
return true;
228-
}
229-
230-
if (ch == '\t') {
231-
return true;
232-
}
233-
234-
return false;
235-
}
236-
237229
const RegEx& Scanner::GetValueRegex() const {
238230
if (InBlockContext()) {
239231
return Exp::Value();
@@ -269,7 +261,7 @@ Token* Scanner::PushToken(Token::TYPE type) {
269261
return &m_tokens.back();
270262
}
271263

272-
Token::TYPE Scanner::GetStartTokenFor(IndentMarker::INDENT_TYPE type) const {
264+
Token::TYPE Scanner::GetStartTokenFor(IndentMarker::INDENT_TYPE type) {
273265
switch (type) {
274266
case IndentMarker::SEQ:
275267
return Token::BLOCK_SEQ_START;

src/scanner.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Scanner {
9090
bool InBlockContext() const { return m_flows.empty(); }
9191
std::size_t GetFlowLevel() const { return m_flows.size(); }
9292

93-
Token::TYPE GetStartTokenFor(IndentMarker::INDENT_TYPE type) const;
93+
static Token::TYPE GetStartTokenFor(IndentMarker::INDENT_TYPE type);
9494

9595
/**
9696
* Pushes an indentation onto the stack, and enqueues the proper token
@@ -131,8 +131,6 @@ class Scanner {
131131
*/
132132
void ThrowParserException(const std::string &msg) const;
133133

134-
bool IsWhitespaceToBeEaten(char ch);
135-
136134
/**
137135
* Returns the appropriate regex to check if the next token is a value token.
138136
*/

0 commit comments

Comments
 (0)