mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 17:29:18 +02:00
minor c++ standard compliance fixes
This commit is contained in:
@@ -384,14 +384,14 @@ struct TBoilerType {
|
|||||||
};
|
};
|
||||||
/*rodzaj odbieraka pradu*/
|
/*rodzaj odbieraka pradu*/
|
||||||
struct TCurrentCollector {
|
struct TCurrentCollector {
|
||||||
long CollectorsNo{ 0 }; //musi być tu, bo inaczej się kopie
|
long CollectorsNo; //musi być tu, bo inaczej się kopie
|
||||||
double MinH{ 0.0 }; double MaxH{ 0.0 }; //zakres ruchu pantografu, nigdzie nie używany
|
double MinH; double MaxH; //zakres ruchu pantografu, nigdzie nie używany
|
||||||
double CSW{ 0.0 }; //szerokość części roboczej (styku) ślizgacza
|
double CSW; //szerokość części roboczej (styku) ślizgacza
|
||||||
double MinV{ 0.0 }; double MaxV{ 0.0 }; //minimalne i maksymalne akceptowane napięcie
|
double MinV; double MaxV; //minimalne i maksymalne akceptowane napięcie
|
||||||
double OVP{ 0.0 }; //czy jest przekaznik nadnapieciowy
|
double OVP; //czy jest przekaznik nadnapieciowy
|
||||||
double InsetV{ 0.0 }; //minimalne napięcie wymagane do załączenia
|
double InsetV; //minimalne napięcie wymagane do załączenia
|
||||||
double MinPress{ 0.0 }; //minimalne ciśnienie do załączenia WS
|
double MinPress; //minimalne ciśnienie do załączenia WS
|
||||||
double MaxPress{ 0.0 }; //maksymalne ciśnienie za reduktorem
|
double MaxPress; //maksymalne ciśnienie za reduktorem
|
||||||
//inline TCurrentCollector() {
|
//inline TCurrentCollector() {
|
||||||
// CollectorsNo = 0;
|
// CollectorsNo = 0;
|
||||||
// MinH, MaxH, CSW, MinV, MaxV = 0.0;
|
// MinH, MaxH, CSW, MinV, MaxV = 0.0;
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ private:
|
|||||||
std::chrono::nanoseconds const m_unusedresourcetimetolive;
|
std::chrono::nanoseconds const m_unusedresourcetimetolive;
|
||||||
typename Container_::size_type const m_unusedresourcesweepsize;
|
typename Container_::size_type const m_unusedresourcesweepsize;
|
||||||
std::string const m_resourcename;
|
std::string const m_resourcename;
|
||||||
typename Container_ &m_container;
|
Container_ &m_container;
|
||||||
typename Container_::size_type m_resourcesweepindex { 0 };
|
typename Container_::size_type m_resourcesweepindex { 0 };
|
||||||
std::chrono::steady_clock::time_point m_resourcetimestamp { std::chrono::steady_clock::now() };
|
std::chrono::steady_clock::time_point m_resourcetimestamp { std::chrono::steady_clock::now() };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -592,10 +592,7 @@ opengl_texture::create() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data.swap( std::vector<char>() ); // TBD, TODO: keep the texture data if we start doing some gpu data cleaning down the road
|
data = std::vector<char>();
|
||||||
/*
|
|
||||||
data_state = resource_state::none;
|
|
||||||
*/
|
|
||||||
data_state = resource_state::none;
|
data_state = resource_state::none;
|
||||||
is_ready = true;
|
is_ready = true;
|
||||||
}
|
}
|
||||||
|
|||||||
36
parser.cpp
36
parser.cpp
@@ -72,6 +72,42 @@ cParser::~cParser()
|
|||||||
mComments.clear();
|
mComments.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
cParser&
|
||||||
|
cParser::operator>>( std::string &Right ) {
|
||||||
|
|
||||||
|
if( true == this->tokens.empty() ) { return *this; }
|
||||||
|
|
||||||
|
Right = this->tokens.front();
|
||||||
|
this->tokens.pop_front();
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<>
|
||||||
|
cParser&
|
||||||
|
cParser::operator>>( bool &Right ) {
|
||||||
|
|
||||||
|
if( true == this->tokens.empty() ) { return *this; }
|
||||||
|
|
||||||
|
Right = ( ( this->tokens.front() == "true" )
|
||||||
|
|| ( this->tokens.front() == "yes" )
|
||||||
|
|| ( this->tokens.front() == "1" ) );
|
||||||
|
this->tokens.pop_front();
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
bool
|
||||||
|
cParser::getToken<bool>( bool const ToLower, const char *Break ) {
|
||||||
|
|
||||||
|
auto const token = getToken<std::string>( true, Break );
|
||||||
|
return ( ( token == "true" )
|
||||||
|
|| ( token == "yes" )
|
||||||
|
|| ( token == "1" ) );
|
||||||
|
}
|
||||||
|
|
||||||
// methods
|
// methods
|
||||||
bool cParser::getTokens(unsigned int Count, bool ToLower, const char *Break)
|
bool cParser::getTokens(unsigned int Count, bool ToLower, const char *Break)
|
||||||
{
|
{
|
||||||
|
|||||||
91
parser.h
91
parser.h
@@ -35,12 +35,6 @@ class cParser //: public std::stringstream
|
|||||||
template <typename Type_>
|
template <typename Type_>
|
||||||
cParser &
|
cParser &
|
||||||
operator>>( Type_ &Right );
|
operator>>( Type_ &Right );
|
||||||
template <>
|
|
||||||
cParser &
|
|
||||||
operator>>( std::string &Right );
|
|
||||||
template <>
|
|
||||||
cParser &
|
|
||||||
operator>>( bool &Right );
|
|
||||||
template <typename Output_>
|
template <typename Output_>
|
||||||
Output_
|
Output_
|
||||||
getToken( bool const ToLower = true, const char *Break = "\n\r\t ;" ) {
|
getToken( bool const ToLower = true, const char *Break = "\n\r\t ;" ) {
|
||||||
@@ -48,41 +42,34 @@ class cParser //: public std::stringstream
|
|||||||
Output_ output;
|
Output_ output;
|
||||||
*this >> output;
|
*this >> output;
|
||||||
return output; };
|
return output; };
|
||||||
template <>
|
inline
|
||||||
bool
|
void
|
||||||
getToken<bool>( bool const ToLower, const char *Break ) {
|
ignoreToken() {
|
||||||
auto const token = getToken<std::string>( true, Break );
|
readToken(); };
|
||||||
return ( ( token == "true" )
|
inline
|
||||||
|| ( token == "yes" )
|
void
|
||||||
|| ( token == "1" ) ); }
|
ignoreTokens(int count) {
|
||||||
inline void ignoreToken()
|
for( int i = 0; i < count; ++i ) {
|
||||||
{
|
readToken(); } };
|
||||||
readToken();
|
inline
|
||||||
};
|
bool
|
||||||
inline void ignoreTokens(int count)
|
expectToken( std::string const &Value ) {
|
||||||
{
|
return readToken() == Value; };
|
||||||
for (int i = 0; i < count; i++)
|
bool
|
||||||
readToken();
|
eof() {
|
||||||
};
|
return mStream->eof(); };
|
||||||
inline bool expectToken(std::string const &value)
|
bool
|
||||||
{
|
ok() {
|
||||||
return readToken() == value;
|
return !mStream->fail(); };
|
||||||
};
|
bool
|
||||||
bool eof()
|
getTokens( unsigned int Count = 1, bool ToLower = true, char const *Break = "\n\r\t ;" );
|
||||||
{
|
|
||||||
return mStream->eof();
|
|
||||||
};
|
|
||||||
bool ok()
|
|
||||||
{
|
|
||||||
return !mStream->fail();
|
|
||||||
};
|
|
||||||
bool getTokens(unsigned int Count = 1, bool ToLower = true, char const *Break = "\n\r\t ;");
|
|
||||||
// returns next incoming token, if any, without removing it from the set
|
// returns next incoming token, if any, without removing it from the set
|
||||||
std::string peek() const {
|
std::string
|
||||||
return (
|
peek() const {
|
||||||
false == tokens.empty() ?
|
return (
|
||||||
tokens.front() :
|
false == tokens.empty() ?
|
||||||
"" ); }
|
tokens.front() :
|
||||||
|
"" ); }
|
||||||
// returns percentage of file processed so far
|
// returns percentage of file processed so far
|
||||||
int getProgress() const;
|
int getProgress() const;
|
||||||
int getFullProgress() const;
|
int getFullProgress() const;
|
||||||
@@ -129,26 +116,12 @@ cParser::operator>>( Type_ &Right ) {
|
|||||||
|
|
||||||
template<>
|
template<>
|
||||||
cParser&
|
cParser&
|
||||||
cParser::operator>>( std::string &Right ) {
|
cParser::operator>>( std::string &Right );
|
||||||
|
|
||||||
if( true == this->tokens.empty() ) { return *this; }
|
|
||||||
|
|
||||||
Right = this->tokens.front();
|
|
||||||
this->tokens.pop_front();
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
cParser&
|
cParser&
|
||||||
cParser::operator>>( bool &Right ) {
|
cParser::operator>>( bool &Right );
|
||||||
|
|
||||||
if( true == this->tokens.empty() ) { return *this; }
|
template<>
|
||||||
|
bool
|
||||||
Right = ( ( this->tokens.front() == "true" )
|
cParser::getToken<bool>( bool const ToLower, const char *Break );
|
||||||
|| ( this->tokens.front() == "yes" )
|
|
||||||
|| ( this->tokens.front() == "1" ) );
|
|
||||||
this->tokens.pop_front();
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user