mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4683 clang-format on all files in ApplicationCode
This commit is contained in:
@@ -12,63 +12,61 @@
|
||||
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
void fieldsByType(caf::PdmObjectHandle* object, std::vector<T*>& typedFields)
|
||||
void fieldsByType( caf::PdmObjectHandle* object, std::vector<T*>& typedFields )
|
||||
{
|
||||
if (!object) return;
|
||||
if ( !object ) return;
|
||||
|
||||
std::vector<caf::PdmFieldHandle*> allFieldsInObject;
|
||||
object->fields(allFieldsInObject);
|
||||
object->fields( allFieldsInObject );
|
||||
|
||||
std::vector<caf::PdmObjectHandle*> children;
|
||||
|
||||
for (const auto& field : allFieldsInObject)
|
||||
for ( const auto& field : allFieldsInObject )
|
||||
{
|
||||
caf::PdmField<T>* typedField = dynamic_cast<caf::PdmField<T>*>(field);
|
||||
if (typedField) typedFields.push_back(&typedField->v());
|
||||
caf::PdmField<T>* typedField = dynamic_cast<caf::PdmField<T>*>( field );
|
||||
if ( typedField ) typedFields.push_back( &typedField->v() );
|
||||
|
||||
caf::PdmField< std::vector<T> >* typedFieldInVector = dynamic_cast<caf::PdmField< std::vector<T> >*>(field);
|
||||
if (typedFieldInVector)
|
||||
caf::PdmField<std::vector<T>>* typedFieldInVector = dynamic_cast<caf::PdmField<std::vector<T>>*>( field );
|
||||
if ( typedFieldInVector )
|
||||
{
|
||||
for (T& typedFieldFromVector : typedFieldInVector->v())
|
||||
for ( T& typedFieldFromVector : typedFieldInVector->v() )
|
||||
{
|
||||
typedFields.push_back(&typedFieldFromVector);
|
||||
typedFields.push_back( &typedFieldFromVector );
|
||||
}
|
||||
}
|
||||
|
||||
field->childObjects(&children);
|
||||
field->childObjects( &children );
|
||||
}
|
||||
|
||||
for (const auto& child : children)
|
||||
for ( const auto& child : children )
|
||||
{
|
||||
fieldsByType(child, typedFields);
|
||||
fieldsByType( child, typedFields );
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RimRelocatePathTest, findPathsInProjectFile)
|
||||
TEST( RimRelocatePathTest, findPathsInProjectFile )
|
||||
{
|
||||
QString fileName = QString("%1/RimRelocatePath/RelocatePath.rsp").arg(TEST_DATA_DIR);
|
||||
QString fileName = QString( "%1/RimRelocatePath/RelocatePath.rsp" ).arg( TEST_DATA_DIR );
|
||||
|
||||
if (fileName.isEmpty()) return;
|
||||
if ( fileName.isEmpty() ) return;
|
||||
|
||||
RimProject project;
|
||||
|
||||
project.fileName = fileName;
|
||||
project.readFile();
|
||||
|
||||
std::vector< caf::FilePath* > filePaths;
|
||||
std::vector<caf::FilePath*> filePaths;
|
||||
|
||||
fieldsByType(&project, filePaths);
|
||||
fieldsByType( &project, filePaths );
|
||||
|
||||
for (auto filePath : filePaths)
|
||||
for ( auto filePath : filePaths )
|
||||
{
|
||||
std::cout << filePath->path().toStdString() << std::endl;
|
||||
}
|
||||
@@ -77,24 +75,24 @@ TEST(RimRelocatePathTest, findPathsInProjectFile)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST(RimRelocatePathTest, DISABLED_LocaleDateStringTest)
|
||||
TEST( RimRelocatePathTest, DISABLED_LocaleDateStringTest )
|
||||
{
|
||||
// Set a non-english system locale on local machine for this test to be useful
|
||||
|
||||
QDateTime dt;
|
||||
{
|
||||
QDate d(2018, 10, 1);
|
||||
dt.setDate(d);
|
||||
QDate d( 2018, 10, 1 );
|
||||
dt.setDate( d );
|
||||
}
|
||||
|
||||
QString formatString("ddd MMM yyyy");
|
||||
QString formatString( "ddd MMM yyyy" );
|
||||
|
||||
// Change the default locale on your system to get a different text then the english formatted text
|
||||
QString defaultString = dt.toString(formatString);
|
||||
QString defaultString = dt.toString( formatString );
|
||||
|
||||
std::cout << "default " << defaultString.toStdString() << std::endl;
|
||||
|
||||
QString englishString = RiaQDateTimeTools::toStringUsingApplicationLocale(dt, formatString);
|
||||
QString englishString = RiaQDateTimeTools::toStringUsingApplicationLocale( dt, formatString );
|
||||
|
||||
std::cout << "english " << englishString.toStdString() << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user