GME  13
Targets.cpp
Go to the documentation of this file.
00001 
00023 #include "../StdAfx.h"
00024 
00025 #if(USESVN)
00026 
00027 #include "Targets.h"
00028 #include "Pool.h"
00029 #include "Util.h"
00030 #include <apr_tables.h>
00031 #include <apr_strings.h>
00032 #include <svn_path.h>
00033 #include <iostream> // remove this later
00035 // Construction/Destruction
00037 
00038 Targets::~Targets()
00039 {
00040         m_targets.clear();
00041 }
00042 
00043 Targets::Targets(const char *path, apr_pool_t* pool)
00044 {
00045         m_pool = pool;
00046         m_targets.push_back(Path(path, pool));
00047         m_error_occured = NULL;
00048         m_doesNotContainsPath = false;
00049 }
00050 
00051 void Targets::add(const char *path)
00052 {
00053         m_targets.push_back(Path(path, m_pool));
00054 }
00055 
00056 const apr_array_header_t *Targets::array (const Pool & pool)
00057 {
00058         std::vector<Path>::const_iterator it;
00059 
00060         apr_pool_t *apr_pool = pool.pool();
00061         apr_array_header_t *apr_targets =
00062                 apr_array_make (apr_pool,
00063                 m_targets.size(),
00064                 sizeof (const char *));
00065 
00066         for (it = m_targets.begin (); it != m_targets.end (); ++it)
00067         {
00068                 const Path &path = *it;
00069                 const char * target =
00070                         apr_pstrdup (apr_pool, path.c_str());
00071                 (*((const char **) apr_array_push (apr_targets))) = target;
00072         }
00073 
00074         return apr_targets;
00075 }
00076 
00077 svn_error_t *Targets::error_occured()
00078 {
00079         return m_error_occured;
00080 }
00081 
00082 void Targets::setDoesNotContainsPath()
00083 {
00084         m_doesNotContainsPath = true;
00085 }
00086 
00087 #endif