MCPcopy Create free account
hub / github.com/PointCloudLibrary/pcl / parseFileExtensionArgument

Function parseFileExtensionArgument

tools/concatenate_points_pcd.cpp:61–87  ·  view source on GitHub ↗

/////////////////////////////////////////////////////////////////////////// \brief Parse command line arguments for file names. * Returns: a vector with file names indices. * \param argc * \param argv * \param extension */

Source from the content-addressed store, hash-verified

59 * \param extension
60 */
61std::vector<int>
62parseFileExtensionArgument (int argc, char** argv, std::string extension)
63{
64 std::vector<int> indices;
65 for (int i = 1; i < argc; ++i)
66 {
67 std::string fname = std::string (argv[i]);
68
69 // Needs to be at least 4: .ext
70 if (fname.size () <= 4)
71 continue;
72
73 // For being case insensitive
74 std::transform (fname.begin (), fname.end (), fname.begin (), tolower);
75 std::transform (extension.begin (), extension.end (), extension.begin (), tolower);
76
77 // Check if found
78 std::string::size_type it;
79 if ((it = fname.find (extension)) != std::string::npos)
80 {
81 // Additional check: we want to be able to differentiate between .p and .png
82 if ((extension.size () - (fname.size () - it)) == 0)
83 indices.push_back (i);
84 }
85 }
86 return (indices);
87}
88
89bool
90loadCloud (const std::string &filename, pcl::PCLPointCloud2 &cloud)

Callers 1

mainFunction · 0.85

Calls 6

transformFunction · 0.70
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected