Skip to content

Commit

Permalink
Merge pull request #119 from Geode-solutions/fix/replace-absl-string-…
Browse files Browse the repository at this point in the history
…view-with-std

fix(StringView): use std::string_view
  • Loading branch information
panquez authored Jul 11, 2024
2 parents 3d78ef5 + 7173b81 commit 7baaa01
Show file tree
Hide file tree
Showing 84 changed files with 295 additions and 317 deletions.
8 changes: 0 additions & 8 deletions bindings/python/src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include <absl/container/fixed_array.h>
#include <absl/container/inlined_vector.h>
#include <absl/strings/string_view.h>
#include <absl/types/span.h>

namespace pybind11
Expand Down Expand Up @@ -70,12 +69,5 @@ namespace pybind11

std::vector< typename std::remove_const< Type >::type > cpp_;
};

template <>
struct type_caster< absl::string_view >
: string_caster< absl::string_view, true >
{
};

} // namespace detail
} // namespace pybind11
5 changes: 2 additions & 3 deletions bindings/python/src/implicit/representation/core/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,13 @@ namespace geode
.def( "repair_horizon_stack_if_possible_3d",
&repair_horizon_stack_if_possible< 3 > )
.def( "implicit_section_from_cross_section_scalar_field",
[]( CrossSection& model,
absl::string_view attribute_name ) {
[]( CrossSection& model, std::string_view attribute_name ) {
return implicit_section_from_cross_section_scalar_field(
model.clone(), attribute_name );
} )
.def( "implicit_model_from_structural_model_scalar_field",
[]( StructuralModel& model,
absl::string_view attribute_name ) {
std::string_view attribute_name ) {
return implicit_model_from_structural_model_scalar_field(
model.clone(), attribute_name );
} )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,80 +48,80 @@ namespace geode
void assign_edged_curve_geographic_coordinate_system_info(
const EdgedCurve< dimension >& mesh,
EdgedCurveBuilder< dimension >& builder,
absl::string_view crs_name,
std::string_view crs_name,
typename GeographicCoordinateSystem< dimension >::Info info );

template < index_t dimension >
void assign_point_set_geographic_coordinate_system_info(
const PointSet< dimension >& mesh,
PointSetBuilder< dimension >& builder,
absl::string_view crs_name,
std::string_view crs_name,
typename GeographicCoordinateSystem< dimension >::Info info );

template < index_t dimension >
void assign_solid_mesh_geographic_coordinate_system_info(
const SolidMesh< dimension >& mesh,
SolidMeshBuilder< dimension >& builder,
absl::string_view crs_name,
std::string_view crs_name,
typename GeographicCoordinateSystem< dimension >::Info info );

template < index_t dimension >
void assign_surface_mesh_geographic_coordinate_system_info(
const SurfaceMesh< dimension >& mesh,
SurfaceMeshBuilder< dimension >& builder,
absl::string_view crs_name,
std::string_view crs_name,
typename GeographicCoordinateSystem< dimension >::Info info );

void opengeode_geosciences_explicit_api
assign_brep_geographic_coordinate_system_info( const BRep& brep,
BRepBuilder& builder,
absl::string_view crs_name,
std::string_view crs_name,
const GeographicCoordinateSystem3D::Info& info );

void opengeode_geosciences_explicit_api
assign_section_geographic_coordinate_system_info(
const Section& section,
SectionBuilder& builder,
absl::string_view crs_name,
std::string_view crs_name,
const GeographicCoordinateSystem2D::Info& info );

template < index_t dimension >
void convert_edged_curve_coordinate_reference_system(
const EdgedCurve< dimension >& mesh,
EdgedCurveBuilder< dimension >& builder,
absl::string_view crs_name,
std::string_view crs_name,
typename GeographicCoordinateSystem< dimension >::Info info );

template < index_t dimension >
void convert_point_set_coordinate_reference_system(
const PointSet< dimension >& mesh,
PointSetBuilder< dimension >& builder,
absl::string_view crs_name,
std::string_view crs_name,
typename GeographicCoordinateSystem< dimension >::Info info );

template < index_t dimension >
void convert_solid_mesh_coordinate_reference_system(
const SolidMesh< dimension >& mesh,
SolidMeshBuilder< dimension >& builder,
absl::string_view crs_name,
std::string_view crs_name,
typename GeographicCoordinateSystem< dimension >::Info info );

template < index_t dimension >
void convert_surface_mesh_coordinate_reference_system(
const SurfaceMesh< dimension >& mesh,
SurfaceMeshBuilder< dimension >& builder,
absl::string_view crs_name,
std::string_view crs_name,
typename GeographicCoordinateSystem< dimension >::Info info );

void opengeode_geosciences_explicit_api
convert_brep_coordinate_reference_system( const BRep& brep,
BRepBuilder& builder,
absl::string_view crs_name,
std::string_view crs_name,
const GeographicCoordinateSystem3D::Info& info );

void opengeode_geosciences_explicit_api
convert_section_coordinate_reference_system( const Section& section,
SectionBuilder& builder,
absl::string_view crs_name,
std::string_view crs_name,
const GeographicCoordinateSystem2D::Info& info );
} // namespace geode
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ namespace geode
class FaultBlocksBuilder
{
public:
void load_fault_blocks( absl::string_view directory );
void load_fault_blocks( std::string_view directory );

void set_fault_block_name( const uuid& id, absl::string_view name );
void set_fault_block_name( const uuid& id, std::string_view name );

protected:
explicit FaultBlocksBuilder( FaultBlocks< dimension >& fault_blocks )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ namespace geode
class FaultsBuilder
{
public:
void load_faults( absl::string_view directory );
void load_faults( std::string_view directory );

void set_fault_type( const uuid& fault_id,
typename Fault< dimension >::FAULT_TYPE type );

void set_fault_name( const uuid& id, absl::string_view name );
void set_fault_name( const uuid& id, std::string_view name );

protected:
explicit FaultsBuilder( Faults< dimension >& faults )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ namespace geode
class HorizonsBuilder
{
public:
void load_horizons( absl::string_view directory );
void load_horizons( std::string_view directory );

void set_horizon_type( const uuid& horizon_id,
typename Horizon< dimension >::HORIZON_TYPE type );

void set_horizon_name( const uuid& id, absl::string_view name );
void set_horizon_name( const uuid& id, std::string_view name );

protected:
explicit HorizonsBuilder( Horizons< dimension >& horizons )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ namespace geode
class StratigraphicUnitsBuilder
{
public:
void load_stratigraphic_units( absl::string_view directory );
void load_stratigraphic_units( std::string_view directory );

void set_stratigraphic_unit_name(
const uuid& id, absl::string_view name );
const uuid& id, std::string_view name );

protected:
explicit StratigraphicUnitsBuilder(
Expand Down
2 changes: 1 addition & 1 deletion include/geode/geosciences/explicit/mixin/core/fault.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace geode

void set_type( FAULT_TYPE type, FaultsBuilderKey );

void set_fault_name( absl::string_view name, FaultsBuilderKey )
void set_fault_name( std::string_view name, FaultsBuilderKey )
{
this->set_name( name );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace geode
FaultBlock( FaultBlocksKey ) : FaultBlock(){};

void set_fault_block_name(
absl::string_view name, FaultBlocksBuilderKey )
std::string_view name, FaultBlocksBuilderKey )
{
this->set_name( name );
}
Expand Down
4 changes: 2 additions & 2 deletions include/geode/geosciences/explicit/mixin/core/fault_blocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ namespace geode

FaultBlockRange fault_blocks() const;

void save_fault_blocks( absl::string_view directory ) const;
void save_fault_blocks( std::string_view directory ) const;

protected:
friend class FaultBlocksBuilder< dimension >;
Expand Down Expand Up @@ -129,7 +129,7 @@ namespace geode

void delete_fault_block( const FaultBlock< dimension >& fault_block );

void load_fault_blocks( absl::string_view directory );
void load_fault_blocks( std::string_view directory );

ModifiableFaultBlockRange modifiable_fault_blocks();

Expand Down
4 changes: 2 additions & 2 deletions include/geode/geosciences/explicit/mixin/core/faults.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ namespace geode

FaultRange faults() const;

void save_faults( absl::string_view directory ) const;
void save_faults( std::string_view directory ) const;

protected:
friend class FaultsBuilder< dimension >;
Expand Down Expand Up @@ -135,7 +135,7 @@ namespace geode

void delete_fault( const Fault< dimension >& fault );

void load_faults( absl::string_view directory );
void load_faults( std::string_view directory );

ModifiableFaultRange modifiable_faults();

Expand Down
2 changes: 1 addition & 1 deletion include/geode/geosciences/explicit/mixin/core/horizon.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace geode

void set_type( HORIZON_TYPE type, HorizonsBuilderKey );

void set_horizon_name( absl::string_view name, HorizonsBuilderKey )
void set_horizon_name( std::string_view name, HorizonsBuilderKey )
{
this->set_name( name );
}
Expand Down
4 changes: 2 additions & 2 deletions include/geode/geosciences/explicit/mixin/core/horizons.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ namespace geode

HorizonRange horizons() const;

void save_horizons( absl::string_view directory ) const;
void save_horizons( std::string_view directory ) const;

protected:
friend class HorizonsBuilder< dimension >;
Expand Down Expand Up @@ -136,7 +136,7 @@ namespace geode

void delete_horizon( const Horizon< dimension >& horizon );

void load_horizons( absl::string_view directory );
void load_horizons( std::string_view directory );

ModifiableHorizonRange modifiable_horizons();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace geode
StratigraphicUnit( StratigraphicUnitsKey ) : StratigraphicUnit() {}

void set_stratigraphic_unit_name(
absl::string_view name, StratigraphicUnitsBuilderKey )
std::string_view name, StratigraphicUnitsBuilderKey )
{
this->set_name( name );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace geode

StratigraphicUnitRange stratigraphic_units() const;

void save_stratigraphic_units( absl::string_view directory ) const;
void save_stratigraphic_units( std::string_view directory ) const;

protected:
friend class StratigraphicUnitsBuilder< dimension >;
Expand Down Expand Up @@ -139,7 +139,7 @@ namespace geode
void delete_stratigraphic_unit(
const StratigraphicUnit< dimension >& stratigraphic_unit );

void load_stratigraphic_units( absl::string_view directory );
void load_stratigraphic_units( std::string_view directory );

ModifiableStratigraphicUnitRange modifiable_stratigraphic_units();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ namespace geode

CrossSection clone() const;

static constexpr absl::string_view native_extension_static()
static constexpr std::string_view native_extension_static()
{
return "og_xsctn";
}

absl::string_view native_extension() const
std::string_view native_extension() const
{
return native_extension_static();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ namespace geode

StructuralModel clone() const;

static constexpr absl::string_view native_extension_static()
static constexpr std::string_view native_extension_static()
{
return "og_strm";
}

absl::string_view native_extension() const
std::string_view native_extension() const
{
return native_extension_static();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#pragma once

#include <absl/strings/string_view.h>
#include <string_view>

#include <geode/basic/factory.h>

Expand All @@ -45,7 +45,7 @@ namespace geode
* @param[in] filename Path to the file to load.
*/
CrossSection opengeode_geosciences_explicit_api load_cross_section(
absl::string_view filename );
std::string_view filename );

class CrossSectionInput : public Input< CrossSection >
{
Expand All @@ -55,18 +55,18 @@ namespace geode
using typename Base::MissingFiles;

protected:
explicit CrossSectionInput( absl::string_view filename )
explicit CrossSectionInput( std::string_view filename )
: Base{ filename }
{
}
};

CrossSectionInput::MissingFiles opengeode_geosciences_explicit_api
check_cross_section_missing_files( absl::string_view filename );
check_cross_section_missing_files( std::string_view filename );

bool opengeode_geosciences_explicit_api is_cross_section_loadable(
absl::string_view filename );
std::string_view filename );

using CrossSectionInputFactory =
Factory< std::string, CrossSectionInput, absl::string_view >;
Factory< std::string, CrossSectionInput, std::string_view >;
} // namespace geode
Loading

0 comments on commit 7baaa01

Please sign in to comment.