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