mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-04 19:59:25 +01:00
refactor(sonar): take read-only string parameters as std::string_view (cpp:S6009)
The Windows messaging helpers keep std::string, they need c_str().
This commit is contained in:
@@ -2518,7 +2518,7 @@ class TMoverParameters
|
|||||||
|
|
||||||
/* funckje dla wagonow*/
|
/* funckje dla wagonow*/
|
||||||
bool AssignLoad(std::string const &Name, float const Amount = 0.f);
|
bool AssignLoad(std::string const &Name, float const Amount = 0.f);
|
||||||
bool LoadingDone(double LSpeed, std::string const &Loadname);
|
bool LoadingDone(double LSpeed, std::string_view Loadname);
|
||||||
bool PermitDoors(side const Door, bool const State = true, range_t const Notify = range_t::consist);
|
bool PermitDoors(side const Door, bool const State = true, range_t const Notify = range_t::consist);
|
||||||
void PermitDoors_(side const Door, bool const State = true);
|
void PermitDoors_(side const Door, bool const State = true);
|
||||||
bool ChangeDoorPermitPreset(int const Change, range_t const Notify = range_t::consist);
|
bool ChangeDoorPermitPreset(int const Change, range_t const Notify = range_t::consist);
|
||||||
|
|||||||
@@ -8454,7 +8454,7 @@ bool TMoverParameters::AssignLoad(std::string const &Loadname, float const Amoun
|
|||||||
// Q: 20160713
|
// Q: 20160713
|
||||||
// Test zakończenia załadunku / rozładunku
|
// Test zakończenia załadunku / rozładunku
|
||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
bool TMoverParameters::LoadingDone(double const LSpeed, std::string const &Loadname)
|
bool TMoverParameters::LoadingDone(double const LSpeed, std::string_view Loadname)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (LSpeed == 0.0)
|
if (LSpeed == 0.0)
|
||||||
@@ -9005,7 +9005,7 @@ bool startLIGHTSLIST;
|
|||||||
bool startCOMPRESSORLIST;
|
bool startCOMPRESSORLIST;
|
||||||
int LISTLINE;
|
int LISTLINE;
|
||||||
|
|
||||||
bool issection(std::string const &Name, std::string const &Input)
|
bool issection(std::string_view Name, std::string_view Input)
|
||||||
{
|
{
|
||||||
|
|
||||||
return Input.compare(0, Name.size(), Name) == 0;
|
return Input.compare(0, Name.size(), Name) == 0;
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ TTranscripts Transcripts;
|
|||||||
|
|
||||||
// dodanie linii do tabeli, (show) i (hide) w [s] od aktualnego czasu
|
// dodanie linii do tabeli, (show) i (hide) w [s] od aktualnego czasu
|
||||||
void
|
void
|
||||||
TTranscripts::AddLine( std::string const &txt, float show, float hide, bool it ) {
|
TTranscripts::AddLine( std::string_view txt, float show, float hide, bool it ) {
|
||||||
|
|
||||||
if( show == hide ) { return; } // komentarz jest ignorowany
|
if( show == hide ) { return; } // komentarz jest ignorowany
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public:
|
|||||||
// constructors
|
// constructors
|
||||||
TTranscripts() = default;
|
TTranscripts() = default;
|
||||||
// methods
|
// methods
|
||||||
void AddLine( std::string const &txt, float show, float hide, bool it );
|
void AddLine( std::string_view txt, float show, float hide, bool it );
|
||||||
// dodanie tekstów, długość dźwięku, czy istotne
|
// dodanie tekstów, długość dźwięku, czy istotne
|
||||||
void Add( std::string const &txt, bool background = false );
|
void Add( std::string const &txt, bool background = false );
|
||||||
// usuwanie niepotrzebnych (ok. 10 razy na sekundę)
|
// usuwanie niepotrzebnych (ok. 10 razy na sekundę)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
#include "glsl_common.h"
|
#include "glsl_common.h"
|
||||||
#include "utilities/Logs.h"
|
#include "utilities/Logs.h"
|
||||||
|
|
||||||
inline bool strcend(std::string const &value, std::string const &ending)
|
inline bool strcend(std::string_view value, std::string_view ending)
|
||||||
{
|
{
|
||||||
if (ending.size() > value.size())
|
if (ending.size() > value.size())
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ basic_controller::output( element_handle const Element ) const -> int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto
|
auto
|
||||||
basic_controller::load( std::string const &Filename ) -> bool {
|
basic_controller::load( std::string_view Filename) -> bool {
|
||||||
|
|
||||||
m_program.clear();
|
m_program.clear();
|
||||||
m_updateaccumulator = 0.0;
|
m_updateaccumulator = 0.0;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class basic_controller {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// methods
|
// methods
|
||||||
auto load( std::string const &Filename ) -> bool;
|
auto load( std::string_view Filename) -> bool;
|
||||||
auto update( double const Timestep ) -> int;
|
auto update( double const Timestep ) -> int;
|
||||||
// finds element with specified name, potentially creating new element of specified type initialized with provided arguments. returns: handle to the element
|
// finds element with specified name, potentially creating new element of specified type initialized with provided arguments. returns: handle to the element
|
||||||
template<typename ...Args_>
|
template<typename ...Args_>
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
|
|
||||||
TMemCell::TMemCell( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
TMemCell::TMemCell( scene::node_data const &Nodedata ) : basic_node( Nodedata ) {}
|
||||||
|
|
||||||
void TMemCell::UpdateValues( std::string const &szNewText, double const fNewValue1, double const fNewValue2, int const CheckMask )
|
void TMemCell::UpdateValues( std::string_view szNewText, double const fNewValue1, double const fNewValue2, int const CheckMask )
|
||||||
{
|
{
|
||||||
if (CheckMask & basic_event::flags::mode_add)
|
if (CheckMask & basic_event::flags::mode_add)
|
||||||
{ // dodawanie wartości
|
{ // dodawanie wartości
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ public:
|
|||||||
explicit TMemCell( scene::node_data const &Nodedata );
|
explicit TMemCell( scene::node_data const &Nodedata );
|
||||||
// methods
|
// methods
|
||||||
void
|
void
|
||||||
UpdateValues( std::string const &szNewText, double const fNewValue1, double const fNewValue2, int const CheckMask );
|
UpdateValues( std::string_view szNewText, double const fNewValue1, double const fNewValue2, int const CheckMask );
|
||||||
bool
|
bool
|
||||||
Load(cParser *parser);
|
Load(cParser *parser);
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ bool TTrainParameters::UpdateMTable( scenario_time const &Time, std::string cons
|
|||||||
return UpdateMTable( Time.data().wHour, Time.data().wMinute + Time.data().wSecond * 0.0167, NewName );
|
return UpdateMTable( Time.data().wHour, Time.data().wMinute + Time.data().wSecond * 0.0167, NewName );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TTrainParameters::UpdateMTable(double hh, double mm, std::string const &NewName)
|
bool TTrainParameters::UpdateMTable(double hh, double mm, std::string_view NewName)
|
||||||
/*odfajkowanie dojechania do stacji (NewName) i przeliczenie opóźnienia*/
|
/*odfajkowanie dojechania do stacji (NewName) i przeliczenie opóźnienia*/
|
||||||
{
|
{
|
||||||
bool OK;
|
bool OK;
|
||||||
@@ -205,7 +205,7 @@ TTrainParameters::TTrainParameters(std::string const &NewTrainName)
|
|||||||
NewName(NewTrainName);
|
NewName(NewTrainName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrainParameters::NewName(std::string const &NewTrainName)
|
void TTrainParameters::NewName(std::string_view NewTrainName)
|
||||||
/*wstępne ustawienie parametrów rozkładu jazdy*/
|
/*wstępne ustawienie parametrów rozkładu jazdy*/
|
||||||
{
|
{
|
||||||
TrainName = NewTrainName;
|
TrainName = NewTrainName;
|
||||||
|
|||||||
@@ -78,11 +78,11 @@ class TTrainParameters
|
|||||||
bool IsTimeToGo(double hh, double mm) const;
|
bool IsTimeToGo(double hh, double mm) const;
|
||||||
// returns: difference between specified time and scheduled departure from current stop, in seconds
|
// returns: difference between specified time and scheduled departure from current stop, in seconds
|
||||||
double seconds_until_departure( double const Hour, double const Minute ) const;
|
double seconds_until_departure( double const Hour, double const Minute ) const;
|
||||||
bool UpdateMTable(double hh, double mm, std::string const &NewName);
|
bool UpdateMTable(double hh, double mm, std::string_view NewName);
|
||||||
bool UpdateMTable( scenario_time const &Time, std::string const &NewName );
|
bool UpdateMTable( scenario_time const &Time, std::string const &NewName );
|
||||||
bool RewindTimeTable( std::string actualStationName );
|
bool RewindTimeTable( std::string actualStationName );
|
||||||
explicit TTrainParameters( std::string const &NewTrainName = "none" );
|
explicit TTrainParameters( std::string const &NewTrainName = "none" );
|
||||||
void NewName(std::string const &NewTrainName);
|
void NewName(std::string_view NewTrainName);
|
||||||
void UpdateVelocity(int StationCount, double vActual);
|
void UpdateVelocity(int StationCount, double vActual);
|
||||||
bool LoadTTfile(std::string const &scnpath, int iPlus, double vmax);
|
bool LoadTTfile(std::string const &scnpath, int iPlus, double vmax);
|
||||||
bool DirectionChange() const;
|
bool DirectionChange() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user