remove white spaces, meaningless or case-specific information from a comment line
| 870 | |
| 871 | /// remove white spaces, meaningless or case-specific information from a comment line |
| 872 | void trimComment( std::string_view& line ) |
| 873 | { |
| 874 | while ( !line.empty() && ( line[0] == '#' || line[0] == ' ' || line[0] == '\t' ) ) |
| 875 | line.remove_prefix( 1 ); |
| 876 | while ( !line.empty() && ( line.back() == ' ' || line.back() == '\t' || line.back() == '\r' || line.back() == '\n' ) ) |
| 877 | line.remove_suffix( 1 ); |
| 878 | if ( line.empty() ) |
| 879 | return; |
| 880 | |
| 881 | //'1068822 vertices, 2102387 faces' |
| 882 | if ( line.ends_with( " faces" ) && line.find( " vertices, " ) != std::string_view::npos ) |
| 883 | { |
| 884 | line = std::string_view{}; |
| 885 | return; |
| 886 | } |
| 887 | |
| 888 | //'URANIUM OBJ EXPORT Mon 12 Jan 2026 20:26:57' |
| 889 | if ( line.starts_with( "URANIUM OBJ EXPORT " ) ) |
| 890 | { |
| 891 | line = line.substr( 0, 18 ); |
| 892 | return; |
| 893 | } |
| 894 | |
| 895 | //'BlueSkyPlan 5.0.29.1 08/01/2026 15:04:20 UTC' |
| 896 | if ( line.starts_with( "BlueSkyPlan " ) ) |
| 897 | { |
| 898 | line = line.substr( 0, line.find_first_of( ' ', 13 ) ); // till the space after version |
| 899 | return; |
| 900 | } |
| 901 | |
| 902 | //'Created by meshio v5.3.5, 2026-02-08T17:36:42.731777' |
| 903 | if ( line.starts_with( "Created by meshio " ) ) |
| 904 | { |
| 905 | line = line.substr( 0, line.find_first_of( ' ', 19 ) ); // till the space after version |
| 906 | return; |
| 907 | } |
| 908 | |
| 909 | //'Reconstructed 4D: Element_V5' |
| 910 | if ( line.starts_with( "Reconstructed 4D: " ) ) |
| 911 | { |
| 912 | line = line.substr( 0, 17 ); // 'Reconstructed 4D:' |
| 913 | return; |
| 914 | } |
| 915 | |
| 916 | //'Wavefront OBJ file written 2018-08-03T14:33:08' |
| 917 | if ( line.starts_with( "Wavefront OBJ file written " ) ) |
| 918 | { |
| 919 | line = line.substr( 0, 26 ); // 'Wavefront OBJ file written' |
| 920 | return; |
| 921 | } |
| 922 | |
| 923 | //'Wavefront OBJ file: filename.obj' |
| 924 | if ( line.starts_with( "Wavefront OBJ file: " ) ) |
| 925 | { |
| 926 | line = line.substr( 0, 19 ); // 'Wavefront OBJ file:' |
| 927 | return; |
| 928 | } |
| 929 |
no test coverage detected