// file : bpkg/manifest-utility.hxx -*- C++ -*- // copyright : Copyright (c) 2014-2017 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file #ifndef BPKG_MANIFEST_UTILITY_HXX #define BPKG_MANIFEST_UTILITY_HXX #include #include #include namespace bpkg { // Package naming schemes. // enum class package_scheme { none, sys }; // Extract scheme from [:]. Position the pointer right after // the scheme end if present, otherwise leave unchanged. // package_scheme parse_package_scheme (const char*&); // Extract name and version components from [/]. // string parse_package_name (const char*); version parse_package_version (const char*); // If the passed location is a relative local path, then assume this is a // relative path to the repository directory and complete it based on the // current working directory. Diagnose invalid locations and throw failed. // repository_location parse_location (const char*, optional); // Return the repository state subdirectory for the specified location as it // appears under .bpkg/repositories/ in the bpkg configuration. Return empty // directory if the repository type doesn't have any state. // // Note that the semantics used to produce this name is repository type- // specific and can base on the repository canonical name or (potentially a // subset of) the location URL. In particular, a state directory could be // shared by multiple repository locations of the same type (@@ TODO: if we // ever do this, then we will need to complicate the removal logic). // dir_path repository_state (const repository_location&); // Return true if the argument is a valid repository canonical name. // bool repository_name (const string&); } #endif // BPKG_MANIFEST_UTILITY_HXX