stop exposing tinyxml

This commit is contained in:
Brian Gerkey 2011-10-22 17:37:42 +00:00
parent 4e374754e8
commit 57d54858cb
2 changed files with 25 additions and 19 deletions

View File

@ -59,6 +59,11 @@ static const int MAX_CRAWL_DEPTH = 1000;
static const int MAX_DEPENDENCY_DEPTH = 1000;
static const double DEFAULT_MAX_CACHE_AGE = 60.0;
rospack_tinyxml::TiXmlElement*
get_manifest_root(const std::string& name,
const std::string& manifest_path,
rospack_tinyxml::TiXmlDocument& manifest);
class Exception : public std::runtime_error
{
public:
@ -293,20 +298,6 @@ Rosstackage::loadManifest(Stackage* stackage)
stackage->manifest_loaded_ = true;
}
rospack_tinyxml::TiXmlElement*
Rosstackage::getManifestRoot(Stackage* stackage)
{
loadManifest(stackage);
rospack_tinyxml::TiXmlElement* ele = stackage->manifest_.RootElement();
if(!ele)
{
std::string errmsg = std::string("error parsing manifest of package ") +
stackage->name_ + " at " + stackage->manifest_path_;
throw Exception(errmsg);
}
return ele;
}
void
Rosstackage::computeDeps(Stackage* stackage)
{
@ -315,7 +306,11 @@ Rosstackage::computeDeps(Stackage* stackage)
stackage->deps_computed_ = true;
rospack_tinyxml::TiXmlElement* root = getManifestRoot(stackage);
loadManifest(stackage);
rospack_tinyxml::TiXmlElement* root =
get_manifest_root(stackage->name_,
stackage->manifest_path_,
stackage->manifest_);
rospack_tinyxml::TiXmlNode *dep_node = NULL;
while((dep_node = root->IterateChildren("depend", dep_node)))
{
@ -631,6 +626,21 @@ void Rosstack::crawl(const std::vector<std::string>& search_path,
Rosstackage::crawl(search_path, force);
}
rospack_tinyxml::TiXmlElement*
get_manifest_root(const std::string& name,
const std::string& manifest_path,
rospack_tinyxml::TiXmlDocument& manifest)
{
rospack_tinyxml::TiXmlElement* ele = manifest.RootElement();
if(!ele)
{
std::string errmsg = std::string("error parsing manifest of package ") +
name + " at " + manifest_path;
throw Exception(errmsg);
}
return ele;
}
void
get_search_path_from_env(std::vector<std::string>& sp)

View File

@ -29,8 +29,6 @@
#ifndef ROSPACK_ROSPACK_H
#define ROSPACK_ROSPACK_H
#include "tinyxml-2.5.3/tinyxml.h"
#include <boost/tr1/unordered_set.hpp>
#include <boost/tr1/unordered_map.hpp>
#include <string>
@ -48,7 +46,6 @@ typedef enum
} crawl_direction_t;
class Stackage;
class rospack_tinyxml::TiXmlElement;
class Rosstackage
{
@ -68,7 +65,6 @@ class Rosstackage
void gatherDeps(Stackage* stackage, bool direct, int depth,
std::tr1::unordered_set<std::string>& deps_hash,
std::vector<std::string>& deps);
rospack_tinyxml::TiXmlElement* getManifestRoot(Stackage* stackage);
std::string getCachePath();
bool readCache();
void writeCache();