Example #1
0
int main() {
  krpc::Client conn = krpc::connect();
  krpc::services::SpaceCenter space_center(&conn);
  auto vessel = space_center.active_vessel();
  auto part = vessel.parts().with_title("Clamp-O-Tron Docking Port").front();
  vessel.parts().set_controlling(part);
}
PlotsFile::PlotsFile(const std::string& p_path) throw (std::exception) {
	std::string name(p_path);
	std::size_t slash;

	if((slash = p_path.rfind('/')) != std::string::npos) {
		name = name.substr(slash + 1);
	}

	if((slash = p_path.rfind('\\')) != std::string::npos) {
		name = name.substr(slash + 1);
	}

	std::vector<std::string> parts(cryo::util::split(name, "_"));
	if(parts.size() != 4) {
		throw std::runtime_error("Invalid file name");
	}

	m_address = strtoull(parts[0].c_str(), 0, 10);
	m_startNonce = strtoull(parts[1].c_str(), 0, 10);
	m_noncesNumber = atol(parts[2].c_str());
	m_staggerSize = atol(parts[3].c_str());

	m_stream.open(p_path, std::ios::in | std::ios::out | std::ios::binary);
	if(!m_stream) {
		throw std::runtime_error("Unable to open plots file");
	}
}
    static inline SHPObject* apply(MultiPolygon const& multi)
    {
        int const n = geometry::num_points(multi);
        int const ring_count = boost::size(multi) + geometry::num_interior_rings(multi);

        boost::scoped_array<double> x(new double[n]);
        boost::scoped_array<double> y(new double[n]);
        boost::scoped_array<int> parts(new int[ring_count]);

        int ring = 0;
        int offset = 0;

        typedef typename boost::range_value<MultiPolygon>::type polygon_type;
        for (typename boost::range_iterator<MultiPolygon const>::type
                    it = boost::begin(multi);
            it != boost::end(multi);
            ++it)
        {
            shape_create_polygon<polygon_type>::process_polygon(*it, x.get(), y.get(), parts.get(),
                offset, ring);
        }

        return ::SHPCreateObject(SHPT_POLYGON, -1, ring_count, parts.get(), NULL,
                                    n, x.get(), y.get(), NULL, NULL);
    }
Example #4
0
void Plugin::readIndex()
{
    File f(Plugin::GIT_BIN_INDEX);
    if (!f.exists()) f.createFile();
    _index.clear();
    FileInputStream fstr(f.path());
    std::string buffer;
    Poco::StreamCopier::copyToString(fstr, buffer);
    StringTokenizer lines(buffer, "\n", StringTokenizer::TOK_TRIM | StringTokenizer::TOK_IGNORE_EMPTY);
    for (auto line = lines.begin(); line != lines.end(); line++)
    {
        StringTokenizer parts((*line), Plugin::SEPARATOR);
        try 
        {
            IndexEntry e;
            e.filepath = parts[0];
            e.md5 = parts[1];
            e.uuid = parts[2];
            _index.push_back(e);
        } 
        catch (Poco::RangeException e)
        {
            std::cout << "ERROR: Cache file is broken" << std::endl;    
            std::cout << e.displayText() << std::endl;
        }
    }
}
Example #5
0
complex<double> toComplex(const string& str)
{
    vector<string> parts(splitString(str,"(,)"));

    if(parts.size() != 2)
    {
        //should throw...
        return complex<double>(0,0);
    }

    char *endptr = NULL;
    complex<double> num;
    if(parts[0] == "-")
    {
        if(parts[1] == "-")
        {
            return complex<double>(gDoubleNaN, gDoubleNaN);
        }
        double im = strtod(parts[1].c_str(), &endptr);
        return complex<double>(gDoubleNaN,im);
    }

    if(parts[1] == "-")
    {
        double re = strtod(parts[0].c_str(), &endptr);
        return complex<double>(re,gDoubleNaN);
    }

    double re = strtod(parts[0].c_str(), &endptr);
    double im = strtod(parts[1].c_str(), &endptr);

    return complex<double>(re,im);
}
Example #6
0
	void Sys_FreezeGS()
	{
		// fixme : fix up gsstate mess and make it mtgs compatible -- air
#ifdef _STGS_GSSTATE_CODE
		wxString Text;
		if( strgametitle[0] != 0 )
		{
			// only take the first two words
			wxString gsText;

			wxStringTokenizer parts( strgametitle, L" " );

			wxString name( parts.GetNextToken() );	// first part
			wxString part2( parts.GetNextToken() );

			if( !!part2 )
				name += L"_" + part2;

			gsText.Printf( L"%s.%d.gs", WX_STR(name), StatesC );
			Text = Path::Combine( g_Conf->Folders.Savestates, gsText );
		}
		else
		{
			Text = GetGSStateFilename();
		}
#endif

	}
std::vector<std::shared_ptr<DeviceConfig>> DeviceConfig::loadFromFile(const std::string& p_path) throw (std::exception) {
	std::vector<std::shared_ptr<DeviceConfig>> configs;

	std::ifstream file(p_path, std::ios::in);
	if(!file) {
		throw std::runtime_error("Unable to open config file");
	}

	std::unique_ptr<char[]> buf(new char[256]);
	for(unsigned int i = 0 ; file.getline(buf.get(), 256) ; ++i) {
		std::vector<std::string> parts(cryo::util::split(buf.get(), " "));
		if(parts.size() != 5) {
			std::ostringstream message;
			message << "Invalid parameters count at line [" << i << "]";
			throw std::runtime_error(message.str());
		}

		unsigned int platform = std::atol(parts[0].c_str());
		unsigned int device = std::atol(parts[1].c_str());
		std::size_t globalWorkSize = std::atol(parts[2].c_str());
		std::size_t localWorkSize = std::atol(parts[3].c_str());
		unsigned int hashesNumber = std::atol(parts[4].c_str());

		configs.push_back(std::shared_ptr<DeviceConfig>(new DeviceConfig(platform, device, globalWorkSize, localWorkSize, hashesNumber)));
	}

	return configs;
}
Example #8
0
vector<string> Host::buildNetworkInterfacesQuery(string data, unsigned int hostID)
{
  vector<string> returnage;

  istringstream iss(data);
  string nic;

  while(getline(iss, nic, ';'))
  {
    stringstream query;
    istringstream parts(nic);
    string part;

    query << "INSERT INTO networkinterfaces(host_id, name, received, sent, created_at) VALUES(" << hostID;

    while(getline(parts, part, '|'))
    {
      query << ",'" << Database::escapeString(part) << "'";
    }
    query << ", NOW())";

    returnage.push_back(query.str());
  }
  return returnage;
}
Example #9
0
vector<string> Host::buildCpusQuery(string data, unsigned int hostID)
{
  vector<string> returnage;

  istringstream iss(data);
  string cpu;

  while(getline(iss, cpu, ';'))
  {
    stringstream query;
    istringstream bigparts(cpu);
    string bigpart;

    query << "INSERT INTO cpus(host_id, core_number, vendor, model, created_at) VALUES(" << hostID;

    while(getline(bigparts, bigpart, '|'))
    {
      istringstream parts(bigpart);
      string part;
      unsigned int i = 0;
      while(getline(parts, part, ':'))
      {
        if(i == 1)
        {
          query << ",'" << Database::escapeString(part) << "'";
        }
        i++;
      }
    }
    query << ", NOW())";

    returnage.push_back(query.str());
  }
  return returnage;
}
Example #10
0
void WaveTrack::read(Xml& xml)
      {
      for (;;) {
            Xml::Token token = xml.parse();
            const QString& tag = xml.s1();
            switch (token) {
                  case Xml::Error:
                  case Xml::End:
                        goto out_of_WaveTrackRead_forloop;
                  case Xml::TagStart:
                        if (tag == "part") {
                              Part* p = 0;
                              p = Part::readFromXml(xml, this);
                              if(p)
                                parts()->add(p);
                              }
                        else if (AudioTrack::readProperties(xml, tag))
                              xml.unknown("WaveTrack");
                        break;
                  case Xml::Attribut:
                        break;
                  case Xml::TagEnd:
                        if (tag == "wavetrack") {
                              mapRackPluginsToControllers();
                              goto out_of_WaveTrackRead_forloop;
                              }
                  default:
                        break;
                  }
            }
out_of_WaveTrackRead_forloop:
      chainTrackParts(this);
      }
Example #11
0
int main(int argc, char* argv[])
{
  std::cout << "\n  Testing XmlParts class\n "
            << std::string(23,'=') << std::endl;
  std::cout
    << "\n  Note that quotes are returned as single tokens\n\n";

  if(argc < 2)
  {
    std::cout 
      << "\n  please enter name of file to process on command line\n\n";
    return 1;
  }

  for(int i=1; i<argc; ++i)
  {
    std::cout << "\n  Processing file " << argv[i];
    std::cout << "\n  " << std::string(16 + strlen(argv[i]),'-') << "\n\n";
    try
    {
      Toker toker(argv[i]);
      toker.setMode(Toker::xml);
      XmlParts parts(&toker);
    //parts.verbose();                 // uncomment to show token details
      while(parts.get())
        std::cout << parts.show().c_str() << std::endl;
      std::cout << "\n\n";
    }
    catch(std::exception ex)
    {
      std::cout << "\n  " << ex.what() << "\n\n";
    }
  }
}
vector<glm::vec4> BoundingSphere::GetFrustumPlanes(glm::mat4& transform) {
    auto planes = vector<glm::vec4>(6);

    auto a = glm::vec4(transform[0][3],
                       transform[1][3],
                       transform[2][3],
                       transform[3][3]);

    vector<glm::vec4> parts(3);

    for (uint i = 0; i < parts.size(); i++)
    {
        parts[i] = glm::vec4(transform[0][3],
                             transform[1][i],
                             transform[2][i],
                             transform[3][i]);
    }

    for (uint i = 0; i < 6; i++)
    {
        if (i % 2 == 0)
            planes[i] = a - parts[i / 2];
        else
            planes[i] = a + parts[i / 2];
    }

    for (uint i = 0; i < 6; i++)
    {
        planes[i] /= glm::length(vec3(planes[i]));
    }

    return planes;
}
Example #13
0
std::vector<std::string> net::urlSplit(std::string url)
{
    re::PCRE regex;
    regex.compile(
                  "([A-Za-z]+)://([^/?#:]+)(?::(\\d+))?(/[^?#:]+)?(?:[?]([^&#/]+(?:[&;][^&;#/]+)*)?)?(?:[#](.*))?");

    re::PCREMatch match;
    if (regex.match(url, match))
    {
        size_t matchLen = match.size();
        std::vector < std::string > parts(6, "");
        for (size_t i = 1; i <= 6; ++i)
        {
            if (i < matchLen)
                parts[i - 1] = match[i];
        }

        //unquote the query string
        parts[4] = net::unquote(parts[4]);

        return parts;
    }
    else
    {
        throw net::MalformedURLException(url.c_str());
    }
}
Example #14
0
QString AsmFormatter::tidyInstruction( const QString & oldLine )
{
	InstructionParts parts( oldLine );
	QString line;
	
	if ( !parts.label().isEmpty() )
		line = parts.label() + ' ';
	pad( line, m_indentAsmName );
	
	if ( !parts.operand().isEmpty() )
		line += parts.operand() + ' ';
	pad( line, m_indentAsmData );
	
	if ( !parts.operandData().isEmpty() )
		line += parts.operandData();
	pad( line, m_indentComment );
	
	if ( parts.comment().isEmpty() )
	{
		// Remove any whitespace at the end if we're not padding out a comment
		while ( !line.isEmpty() && line[ line.length() - 1 ].isSpace() )
			line.remove( line.length() -1, 1 );
	}
	else
		line += parts.comment();
	
	return line;
}
Example #15
0
IsoFileDescriptor IsoDirectory::FindFile(const wxString& filePath) const
{
	pxAssert( !filePath.IsEmpty() );

	// wxWidgets DOS-style parser should work fine for ISO 9660 path names.  Only practical difference
	// is case sensitivity, and that won't matter for path splitting.
	wxFileName parts( filePath, wxPATH_DOS );
	IsoFileDescriptor info;
	const IsoDirectory* dir = this;
	ScopedPtr<IsoDirectory> deleteme;

	// walk through path ("." and ".." entries are in the directories themselves, so even if the
	// path included . and/or .., it still works)

	for(uint i=0; i<parts.GetDirCount(); ++i)
	{
		info = dir->GetEntry(parts.GetDirs()[i]);
		if(info.IsFile()) throw Exception::FileNotFound( filePath );

		dir = deleteme = new IsoDirectory(internalReader, info);
	}

	if( !parts.GetFullName().IsEmpty() )
		info = dir->GetEntry(parts.GetFullName());

	return info;
}
void test::FSTestFixture::init_cmdline() {
	std::unique_ptr<char* []> parts(new char* [_cmdlineArgs.size()]);

	for (size_t i = 0; i < _cmdlineArgs.size(); ++i) {
		parts[i] = const_cast<char*>(_cmdlineArgs[i].c_str());
	}

	parse_cmdline((int) _cmdlineArgs.size(), parts.get());
}
Example #17
0
static PyObject *
process_postData(PyObject *self, PyObject *args)
{
        const char *doc_buffer;
    std::string processed_doc = "";

    if (!PyArg_ParseTuple(args, "s", &doc_buffer))
        return NULL;

    try
    {
      Toker toker(doc_buffer, false);
      toker.setMode(Toker::xml);
      XmlParts parts(&toker);
      HtmlParts scraper(&parts);

      while(scraper.get())
      {
          // Building a (partial) tree
          // Search for closing tag to select all content in between
          if ( scraper.isPostTitle() )
          {
              processed_doc += scraper.toString();
              while ( scraper.get() && !(scraper.isClosingTag() && scraper.isH2()) )
                  processed_doc += scraper.toString();

              processed_doc += scraper.toString();
          }

          if (scraper.isPostBody())
          {
              /*
               * Note: this will fail if there are nested <div></div>
               */
              while ( scraper.get() && !(scraper.isClosingTag() && scraper.isDiv()) )
              {
                  // String value of current node
                   processed_doc += scraper.toString();
              }
          }
      }

    }
    catch(std::runtime_error ex)
    {
      std::cout << "\n " << ex.what() << "\n\n";
    }
    catch(std::exception ex)
    {
      std::cout << "\n  " << ex.what() << "\n\n";
    }

    return Py_BuildValue("s", processed_doc.c_str());
}
Controller::Ptr ControllerFactory::createController(const std::string& uri)
{
    Poco::StringTokenizer parts(uri, "/");
    for (const auto& creator : _creators)
    {
        if (match(parts, creator.first))
        {
            return creator.second(parts);
        }
    }
    return {};
}
void LeftToRightTabOrder::SaveState(IPresentationSerializer* context,
    IMemento::Pointer memento)
{
  std::vector<IPresentablePart::Pointer> parts(list->GetPartList());

  for (std::vector<IPresentablePart::Pointer>::iterator iter = parts.begin();
       iter != parts.end(); ++iter)
  {
    IMemento::Pointer childMem = memento->CreateChild(WorkbenchConstants::TAG_PART);
    childMem->PutString(WorkbenchConstants::TAG_ID, context->GetId(*iter));
  }
}
Example #20
0
Track Track::load(string name, istream& is) {
    Track track(name);
    Vector<string> parts(2);
    string line;
    while(is.peek() != EOF) {
        is >> line;
        parts = StringUtils::cut(line, ';');
        *(track.points) + new Point(atoi(parts.get(0).c_str()), atoi(parts.get(1).c_str()));
    }
    // Making a copy removes the unused places in the vector
    return Track(track);
}
int main() {
	int x = __VERIFIER_nondet_int();
	if(x < 0)
		return 0;
	int y = __VERIFIER_nondet_int();
	if(y < 0) 
		return 0;
	int z = __VERIFIER_nondet_int();
	for (int p = 0; p <= x; p++)
	    for (int q = 0; q <= x; q++)
		parts(p, q);

}
Example #22
0
u8 Skill::SecondaryPriorityFromRace(u8 race, const std::vector<u8> & exclude)
{
    Rand::Queue parts(MAXSECONDARYSKILL);

    std::vector<u8> skills = SecondarySkills();

    for(std::vector<u8>::const_iterator
	it = skills.begin(); it != skills.end(); ++it)
	if(exclude.empty() ||
	    exclude.end() == std::find(exclude.begin(), exclude.end(), *it))
	    parts.Push(*it, SecondaryGetWeightSkillFromRace(race, *it));

    return parts.Size() ? parts.Get() : Secondary::UNKNOWN;
}
	virtual QString contents( const QString& fileName )
	{
		QString contents = QString::null;
		
		if ( !m_readFromDisk )
		{
			m_deadlock.unlock();
			// GET LOCK
			kapp->lock ();
			
			//kdDebug(9007) << "-------> kapp locked" << endl;
			
			QPtrList<KParts::Part> parts( *m_cppSupport->partController() ->parts() );
			QPtrListIterator<KParts::Part> it( parts );
			while ( it.current() )
			{
				KTextEditor::Document * doc = dynamic_cast<KTextEditor::Document*>( it.current() );
				++it;
				
				KTextEditor::EditInterface* editIface = dynamic_cast<KTextEditor::EditInterface*>( doc );
				if ( !doc || !editIface || doc->url().path() != fileName )
					continue;
				
				contents = QString( editIface->text().ascii() ); // deep copy
				
				//kdDebug(9007) << "-------> kapp unlocked" << endl;
				
				break;
			}

			// RELEASE LOCK
			kapp->unlock();
			m_deadlock.lock();
			//kdDebug(9007) << "-------> kapp unlocked" << endl;
		}
		
		if( m_readFromDisk || contents == QString::null )
		{
			QFile f( fileName );
			if ( f.open( IO_ReadOnly ) )
			{
				QTextStream stream( &f );
				contents = stream.read();
				f.close();
			}
		}
		
		return contents;
	}
Example #24
0
bool TryParse( wxRect& dest, const wxString& src, const wxRect& defval, const wxString& separators )
{
	dest = defval;

	wxStringTokenizer parts( src, separators );

	wxPoint point;
	wxSize size;

	if( !TryParse( point, parts ) ) return false;
	if( !TryParse( size, parts ) ) return false;

	dest = wxRect( point, size );
	return true;
}
Example #25
0
void WaveEdit::songChanged1(MusECore::SongChangedFlags_t bits)
      {
        if(_isDeleting)  // Ignore while while deleting to prevent crash.
          return;

        if (bits & SC_SOLO)
        {
          MusECore::WavePart* part = (MusECore::WavePart*)(parts()->begin()->second);
          solo->blockSignals(true);
          solo->setChecked(part->track()->solo());
          solo->blockSignals(false);
        }  
        
        songChanged(bits);
      }
Example #26
0
int main(int argc, char* argv[])
{
	if(argc != 3)
	{
		std::cerr << "Error: use is " << argv[0] << " <input file> <output file>" << std::endl;
		return 1;
	}

	higan::CSVReader inputFile;
	GlossaryData glossaryData;

	// Open the input file to read options
	inputFile.openFile(argv[1]);
	while(inputFile.hasMoreRows())
	{
		std::vector<std::string> row = inputFile.getRow();
		row.pop_back();
		processInputLine(row,glossaryData);
	}
	inputFile.closeFile();

	std::ofstream outputFile(argv[2]);

	// Open segments which are plain text that don't need modifications
	std::vector<std::ifstream> parts(4);
	for(unsigned i = 0; i < parts.size(); ++i)
	{
		std::stringstream ss;
		ss << "part" << i+1 << ".txt";
		parts[i].open(ss.str());
		if(parts[i].bad())
		{
			std::cerr << "Error: could not open " << ss.str() << std::endl;
			return 2;
		}
	}

	outputFile << parts[0].rdbuf();
	outputFile << glossaryData.numPages;
	outputFile << parts[1].rdbuf();
	outputFile << createGlossaryPageMode(glossaryData).rdbuf();
	outputFile << parts[2].rdbuf();
	outputFile << createGlossaryButtonMode(glossaryData).rdbuf();
	outputFile << parts[3].rdbuf();
	outputFile.close();

	std::cout << "Successfully created " << argv[2] << " from " << argv[1] << std::endl;
}
Example #27
0
    static inline SHPObject* apply(Polygon const& polygon)
    {
        int const n = geometry::num_points(polygon);
        int const ring_count = 1 + geometry::num_interior_rings(polygon);

        boost::scoped_array<double> x(new double[n]);
        boost::scoped_array<double> y(new double[n]);
        boost::scoped_array<int> parts(new int[ring_count]);

        int ring = 0;
        int offset = 0;

        process_polygon(polygon, x.get(), y.get(), parts.get(), offset, ring);

        return ::SHPCreateObject(SHPT_POLYGON, -1, ring_count, parts.get(), NULL,
                                    n, x.get(), y.get(), NULL, NULL);
    }
    virtual QString contents( const QString& fileName )
    {
	if( !m_readFromDisk ){
	    //kdDebug(9013) << "-------> kapp is locked = " << kapp->locked() << endl;
	    bool needToLock = kapp->locked() == false;

	    if( needToLock )
		kapp->lock();

	    //kdDebug(9013) << "-------> kapp locked" << endl;

	    QPtrList<KParts::Part> parts( *m_javaSupport->partController()->parts() );
	    QPtrListIterator<KParts::Part> it( parts );
	    while( it.current() ){
		KTextEditor::Document* doc = dynamic_cast<KTextEditor::Document*>( it.current() );
		++it;

		KTextEditor::EditInterface* editIface = dynamic_cast<KTextEditor::EditInterface*>( doc );
		if( !doc || !editIface || doc->url().path() != fileName )
		    continue;

		QString contents = QString( editIface->text().ascii() ); // deep copy

		if( needToLock )
		    kapp->unlock();

		//kdDebug(9013) << "-------> kapp unlocked" << endl;

		return contents;
	    }

	    if( needToLock )
		kapp->unlock();
	    //kdDebug(9013) << "-------> kapp unlocked" << endl;
	}

	QFile f( fileName );
	QTextStream stream( &f );
	if( f.open(IO_ReadOnly) ){
	    QString contents = stream.read();
	    f.close();
	    return contents;
	}

	return QString::null;
    }
Example #29
0
iMesh*
iResLoader::loadMesh(dString* filePath) {
	CL_THROW_IF_NIL(filePath);
	
	dData* meshData = dData::dataWithContentsOfFile(filePath);
	const dByte* meshBytes = (const dByte*)meshData->bytes();
	
	iSMeshHeader* h = (iSMeshHeader*)meshBytes;
	assert(dSwapLittleIntToHost(h->tag) == kiMeshSignature);
	assert(dSwapLittleIntToHost(h->headerLength) +
		   dSwapLittleIntToHost(h->ibDataSize) +
		   dSwapLittleIntToHost(h->vbDataSize) +
		   dSwapLittleIntToHost(h->meshPartsDataSize) == meshData->length());
	
	meshBytes += dSwapLittleIntToHost(h->headerLength);
	dobj_ptr<dData> ibData(dData::alloc()->initWithBytes(meshBytes, h->ibDataSize));
	dobj_ptr<iIndexBuffer> ib(iIndexBuffer::alloc()->initWithDataAndType(ibData.get(), kiEDataType_UnsignedShort));
	
	meshBytes += dSwapLittleIntToHost(h->ibDataSize);
	dobj_ptr<dData> vbData(dData::alloc()->initWithBytes(meshBytes, h->vbDataSize));
	dobj_ptr<iVertexBuffer> vb(iVertexBuffer::alloc()->initWithDataAndFVF(vbData.get(), (iEFVF)dSwapLittleIntToHost(h->fvf)));
	
	meshBytes += dSwapLittleIntToHost(h->vbDataSize);
	dobj_ptr<dData> mpData(dData::alloc()->initWithBytes(meshBytes, h->meshPartsDataSize));
	const dByte* mpPtr = (const dByte*)mpData->bytes();
	dUInteger dataLength = 0;
	
	dobj_ptr<dDictT<iMeshPart*, dString*> > parts((dDictT<iMeshPart*, dString*>*)
													dDictT<iMeshPart*, dString*>::alloc()->init()); 
	
	while (dataLength < h->meshPartsDataSize) {
		iSMeshPartInfo* partInfo = (iSMeshPartInfo*)mpPtr;
		dobj_ptr<iMeshPart> part(iMeshPart::alloc()->initWithParams(ib.get(), kiEDrawMode_Triangles, partInfo->first, partInfo->count));
		mpPtr += sizeof(iSMeshPartInfo);
		dataLength += sizeof(iSMeshPartInfo);
		
		dobj_ptr<dString> name(dString::alloc()->initWithCharacters((TCHAR*)mpPtr, partInfo->nameLength));
		mpPtr += partInfo->nameLength * sizeof(TCHAR);
		dataLength += partInfo->nameLength * sizeof(TCHAR);
		
		parts->setObjectForKey(part.get(), name.get());
	}
	
	return iMesh::meshWithVertexBufferAndParts(vb.get(), parts.get());
}
int main(int argc, char* argv[])
{ 
  std::cout << "\n  XML Document Object Model \n "<< std::string(20,'=') << std::endl;
  if(argc < 2)  
  { 
    std::cout << "\n  please enter name of file to process on command line\n\n";
    return 1;  
  }    
  for(int i=1; i<argc; ++i)
  { 
    std::cout << "\n  Processing  " << argv[i];
    std::cout << "\n  " << std::string(16 + strlen(argv[i]),'-') << "\n";
    try
    { 
        Toker toker(argv[i]); 
	      toker.setMode(Toker::xml);  
        XmlParts parts(&toker);
        Parser sc(parts);
	      XmlTree t;
	      t.makeRoot(sc.walkScopes());
	      t.show(t.getRoot());
	      t.clearMarks();
	      std::cout << "\n\n"; 
	      t.addtoid("testId");
        std::cout<<"\nThe new tree after adding testTag to testId :-)"<<std::endl;
        t.show(t.getRoot()); 
	      t.clearMarks();
	      std::cout << "\n\n";
        t.removebytag("testTag");
        std:: cout << "--The new TREE after removing testTag"<< "\n\n";
	      t.show(t.getRoot());
	      t.clearMarks();
	      std::cout << "\n\n"<<"Finding the tag title\n\n";
        t.findbytag("testTag");
        std::cout << "\n\n"<<"Finding the id testId\n\n";
        t.findbyid("testId");
    }
  
    catch(std::exception ex)
    {
      std::cout << "\n  " << ex.what() << "\n\n";
    }
  }
}