indenting

This commit is contained in:
Jean-Francois Dockes 2019-02-01 09:02:10 +01:00
parent ba933ccc13
commit 17a8d72227

View File

@ -32,15 +32,15 @@
class Utf8Iter { class Utf8Iter {
public: public:
Utf8Iter(const std::string &in) Utf8Iter(const std::string &in)
: m_sp(&in), m_cl(0), m_pos(0), m_charpos(0) : m_sp(&in) {
{
update_cl(); update_cl();
} }
const std::string& buffer() const {return (*m_sp);} const std::string& buffer() const {
return *m_sp;
}
void rewind() void rewind() {
{
m_cl = 0; m_cl = 0;
m_pos = 0; m_pos = 0;
m_charpos = 0; m_charpos = 0;
@ -50,8 +50,7 @@ public:
/** "Direct" access. Awfully inefficient as we skip from start or current /** "Direct" access. Awfully inefficient as we skip from start or current
* position at best. This can only be useful for a lookahead from the * position at best. This can only be useful for a lookahead from the
* current position */ * current position */
unsigned int operator[](std::string::size_type charpos) const unsigned int operator[](std::string::size_type charpos) const {
{
std::string::size_type mypos = 0; std::string::size_type mypos = 0;
unsigned int mycp = 0; unsigned int mycp = 0;
if (charpos >= m_charpos) { if (charpos >= m_charpos) {
@ -75,8 +74,7 @@ public:
} }
/** Increment current position to next utf-8 char */ /** Increment current position to next utf-8 char */
std::string::size_type operator++(int) std::string::size_type operator++(int) {
{
// Note: m_cl may be zero at eof if user's test not right // Note: m_cl may be zero at eof if user's test not right
// this shouldn't crash the program until actual data access // this shouldn't crash the program until actual data access
#ifdef UTF8ITER_CHECK #ifdef UTF8ITER_CHECK
@ -92,8 +90,7 @@ public:
} }
/** operator* returns the ucs4 value as a machine integer*/ /** operator* returns the ucs4 value as a machine integer*/
unsigned int operator*() unsigned int operator*() {
{
#ifdef UTF8ITER_CHECK #ifdef UTF8ITER_CHECK
assert(m_cl > 0); assert(m_cl > 0);
#endif #endif
@ -146,11 +143,11 @@ private:
const std::string* m_sp; const std::string* m_sp;
// Character length at current position. A value of zero indicates // Character length at current position. A value of zero indicates
// an error. // an error.
unsigned int m_cl; unsigned int m_cl{0};
// Current byte offset in string. // Current byte offset in string.
std::string::size_type m_pos; std::string::size_type m_pos{0};
// Current character position // Current character position
unsigned int m_charpos; unsigned int m_charpos{0};
// Check position and cl against string length // Check position and cl against string length
bool poslok(std::string::size_type p, int l) const { bool poslok(std::string::size_type p, int l) const {
@ -162,8 +159,7 @@ private:
// Update current char length in object state, check // Update current char length in object state, check
// for errors // for errors
inline void update_cl() inline void update_cl() {
{
m_cl = 0; m_cl = 0;
if (m_pos >= m_sp->length()) if (m_pos >= m_sp->length())
return; return;
@ -180,8 +176,7 @@ private:
} }
} }
inline bool checkvalidat(std::string::size_type p, int l) const inline bool checkvalidat(std::string::size_type p, int l) const {
{
switch (l) { switch (l) {
case 1: case 1:
return (unsigned char)(*m_sp)[p] < 128; return (unsigned char)(*m_sp)[p] < 128;
@ -205,8 +200,7 @@ private:
} }
// Get character byte length at specified position. Returns 0 for error. // Get character byte length at specified position. Returns 0 for error.
inline int get_cl(std::string::size_type p) const inline int get_cl(std::string::size_type p) const {
{
unsigned int z = (unsigned char)(*m_sp)[p]; unsigned int z = (unsigned char)(*m_sp)[p];
if (z <= 127) { if (z <= 127) {
return 1; return 1;
@ -225,8 +219,7 @@ private:
} }
// Compute value at given position. No error checking. // Compute value at given position. No error checking.
inline unsigned int getvalueat(std::string::size_type p, int l) const inline unsigned int getvalueat(std::string::size_type p, int l) const {
{
switch (l) { switch (l) {
case 1: case 1:
#ifdef UTF8ITER_CHECK #ifdef UTF8ITER_CHECK