示例#1
0
  void CPPLexer::usingStatement() {
    // A statement spans until a newline is found (or EOF)

    addSegment(pos, 5, Keyword); // using
    pos += 5;

    // Skip whitespaces
    while (str->at(pos) == ' ') {
      pos++;
    }

    if (str->substr(pos, 9).compare("namespace") == 0) {
      addSegment(pos, 9, Keyword); // namespace
      pos += 9;
    }

    // Skip whitespaces
    while (str->at(pos) == ' ') {
      pos++;
    }

    // Whatever identifier we've found until \n
    size_t startSegment = pos;
    while (str->at(pos) != '\n') {
      pos++;
    }
    addSegment(startSegment, pos - startSegment, Normal);
  }
示例#2
0
int ShapeHandler::execute(const std::string &command, bool saveInUndoList)
{
    std::stringstream commandStream;
    commandStream.str(command);
    std::string line;
    std::string commandId;
    //read command line by line
    while(std::getline(commandStream,line))
    {
        std::stringstream lineStream;
        lineStream.str(line);
        lineStream >> commandId;
        if(line.length()==0)
        {
            //do nothing
        }
        else if(commandId.compare("S")==0)
        {
            std::string name;
            int x1,x2,y1,y2;
            lineStream >> name >> x1 >> y1 >> x2 >> y2;
            int returnCode = addSegment(name,Point(x1,y1),Point(x2,y2),saveInUndoList);
            if(returnCode!=0)
            {
            	std::cout << "ERR" << std::endl;
                return  returnCode;
            }
        }
        else if(commandId.compare("R")==0)
示例#3
0
CTIMaskLine::CTIMaskLine(uint lenght, uint nLine, const CTIMaskLineSegment& segm) :
        length_(lenght),
        segments_(0),
        line_(nLine)
{
    addSegment(segm);
}
示例#4
0
void VideoPreview::AddTempFileToPreview(QueueItem* tempItem, HWND serverReadyReport)
{
	if (tempItem != NULL)
	{
		_canUseFile = false;
		clear();
		_callWnd = serverReadyReport;
		_currentFilePreview = tempItem->getTarget();
		_previewFileSize = tempItem->getSize();
		m_tempFilename = tempItem->getTempTarget();
		_fileRoadMap = unique_ptr<FileRoadMap>(new FileRoadMap(_previewFileSize));
		QueueItem::SegmentSet segments;
		{
			RLock(*QueueItem::g_cs);
			segments =  tempItem->getDoneL();
		}
		for (auto i = segments.cbegin(); i != segments.cend(); ++i)
		{
			addSegment(i->getStart(), i->getEnd());
		}
		tempItem->setDelegate(this);
		_canUseFile = true;
		StartServer();
		_viewStarted = false;
	}
}
示例#5
0
void ramActorsScene::loadFile(const string filePath)
{
	if (mSegmentsMap.size() >= MAX_ACTORS)
		return;
	
    try
    {
        coder.load(filePath);
        ramSession session = coder.get();
        
        SegmentsIter it = mSegmentsMap.find(session.getNodeArrayName());
        
        if( it != mSegmentsMap.end() ) return;
        
        const string name = session.getNodeArrayName();
        
        PlaybackSegment *seg = new PlaybackSegment(name);
        seg->session = session;
        seg->session.play();
        addSegment(seg);
    }
    catch (std::exception &e)
    {
        cout << e.what() << endl;
    }
}
示例#6
0
void Level::addSegment(string filename, string context, string id, float length, bool append){
	//mProgressBar->levelParseStarted(filename);
	XML* xml = new XML(filename, context);
	addSegment(
		xml, 
		id,
		length, append);
	
	/*File* f;
	f = new File(filename, context);
	Util::Log("Loading : "+filename, 4);
	if (f->error() != FILE_OK){
		throw((string)("Level file not found : "+(string)filename));
	}else{
		XML xml;
		xml.setContent(f->getStrContent());
		addSegment(
			xml, 
			id,
			length, append);
			//mCurrentSegment = new LevelSegment();
			//mCurrentSegment->build(&xml, elem.getString("name").substr(0,elem.getString("name").length()-4), elem.getFloat("length"));
			//mSegment.push_back(mCurrentSegment);
	}
	delete f;*/
	//mProgressBar->levelParseEnded(filename);
	
}
示例#7
0
CTIMaskLine::CTIMaskLine(uint length, const CTIMaskLineSegment& segm) :
        length_(length),
        segments_(0),
        line_(-1)
{
    addSegment(segm);
}
示例#8
0
 void PathComponent::close()
 {
     if(segments.size() >= 1) {
         Vector2D start = segments[0]->getPoint(0.0f);
         Vector2D end = segments[segments.size() - 1]->getPoint(1.0f);
         addSegment(new LineSegment(start, end));
     }
 }
示例#9
0
void CurvePresenter::setupSignals()
{
    connect(m_model, &CurveModel::segmentAdded, this,
            [&] (CurveSegmentModel* segment)
    {
        addSegment(new CurveSegmentView{segment, m_view});
    });

    connect(m_model, &CurveModel::pointAdded, this,
            [&] (CurvePointModel* point)
    {
        addPoint(new CurvePointView{point, m_view});
    });

    connect(m_model, &CurveModel::pointRemoved, this,
            [&] (CurvePointModel* m)
    {
        auto it = std::find_if(
                      m_points.begin(),
                      m_points.end(),
                      [&] (CurvePointView* pt) { return &pt->model() == m; });

        if(it != m_points.end()) // TODO should never happen ?
        {
            auto val = *it;
            m_points.removeOne(val);

            delete val;
        }
    });
    connect(m_model, &CurveModel::segmentRemoved, this,
            [&] (CurveSegmentModel* m)

    {
        auto it = std::find_if(
                      m_segments.begin(),
                      m_segments.end(),
                      [&] (CurveSegmentView* segment) { return &segment->model() == m; });

        if(it != m_segments.end())
        {
            auto val = *it;
            m_segments.removeOne(val);

            delete val;
        }
    });

    connect(m_model, &CurveModel::cleared, this,
            [&] ()
    {
        qDeleteAll(m_points);
        qDeleteAll(m_segments);
        m_points.clear();
        m_segments.clear();
    });
}
示例#10
0
void detecting(struct snakeNode *head, struct snakeNode **tail, struct Food *food) {
	if ((head->posX - food->posX) * (head->posX - food->posX) 
		+ 
		(head->posY - food->posY) * (head->posY - food->posY) <= 20) {
		*tail = addSegment(*tail, &snakeLength);
		food->isEaten = 1;
	} else {
		/*do nothing*/
	}
}
示例#11
0
void GraphicsScene::paintTriangulation(Triangulation *tri, int i) {
    for(auto p : tri->getPoints()) {
        addPoint(p, i);
    }
    for(auto s : tri->getSegments()) {
        addSegment(s, i);
    }
    for(auto t : tri->getTriangles()) {
        addTriangle(t, i);
    }
}
示例#12
0
void ramActorsScene::rebuildControlPanel()
{
	/// remove all widgets
	mLocalPanel->removeWidgets();
	mLocalPanel->resetPlacer();
	
	
	/// adding panel header
	createPanelHeader();
	
	
	/// insert panels
    map<string, BaseSegment*> tmpMap = mSegmentsMap;
    mSegmentsMap.clear();
    SegmentsIter it = tmpMap.begin();
    
    while (it != tmpMap.end())
    {
        BaseSegment *seg = it->second;
        
        if (seg->getType() == RAM_UI_SEGMENT_TYPE_CONTROL)
        {
            ControlSegment *s = new ControlSegment(seg->getName());
            addSegment(s);
        }
        else if (seg->getType() == RAM_UI_SEGMENT_TYPE_PLAYBACK)
        {
            PlaybackSegment *s = new PlaybackSegment(seg->getName());
            s->session = seg->session;
            s->session.play();
            addSegment(s);
        }
        
        it++;
    }
    
	mLocalPanel->autoSizeToFitWidgets();
	
	setNeedsUpdatePanel(false);
}
    SlhaValueColoredSegments::SlhaValueColoredSegments(
                                         std::string const& colorDefinitionXml,
                                                 double const coloredLineWidth,
                                LHPC::SlhaSimplisticInterpreter& slhaParser ) :
        SlhaValueLineColoring(),
        colorsWithWidths(),
        cumulativeWeightTotal( 0.0 )
    {
      BOL::AsciiXmlParser xmlParser;
      if( xmlParser.loadString( colorDefinitionXml ) )
      {
        while( xmlParser.readNextElement() )
        {
          if( xmlParser.currentElementNameMatches( "LineSegment" ) )
          {
            addSegment( xmlParser.getTrimmedCurrentElementContent(),
                        slhaParser );
          }
        }

        // Now that all the weights have been read, their widths can be set.
        if( cumulativeWeightTotal == 0.0 )
        {
          double const equalWeight( coloredLineWidth
                          / static_cast< double >( colorsWithWidths.size() ) );
          for( std::vector< std::pair< std::string, double > >::iterator
               colorWithWidth( colorsWithWidths.begin() );
               colorWithWidth < colorsWithWidths.end();
               ++colorWithWidth )
          {
            colorWithWidth->second = equalWeight;
          }
        }
        else
        {
          double const
          normalizationFactor( coloredLineWidth / cumulativeWeightTotal );

          for( std::vector< std::pair< std::string, double > >::iterator
               colorWithWidth( colorsWithWidths.begin() );
               colorWithWidth < colorsWithWidths.end();
               ++colorWithWidth )
          {
            colorWithWidth->second *= normalizationFactor;
          }
        }
      }
      else
      {
        throw std::runtime_error( "Could not parse <LineColor>." );
      }
    }
示例#14
0
  void CPPLexer::lineCommentStatement() {
    // A statement spans until a newline is found (or EOF)

    size_t startSegment = pos;

    // Skip everything until \n
    while (str->at(pos) != '\n') {
      pos++;
    }
    // Do not add the \n to the comment (it will be handled outside)

    addSegment(startSegment, pos - startSegment, Comment);
  }
示例#15
0
void SegmentManager::syncWithTerrain()
{
	//There's currently no way to remove segments from the terrain, so we don't have to worry about that for now.

	Mercator::Terrain::Segmentstore segmentStore = mTerrain.getTerrain();
	for (Mercator::Terrain::Segmentstore::const_iterator I = segmentStore.begin(); I != segmentStore.end(); ++I) {
		const Mercator::Terrain::Segmentcolumn& segmentColumn = I->second;
		for (Mercator::Terrain::Segmentcolumn::const_iterator J = segmentColumn.begin(); J != segmentColumn.end(); ++J) {
			Mercator::Segment* segment = J->second;
			addSegment(*segment);
		}
	}
}
示例#16
0
void
Polygon::setPolygon(QList<QPointF>& points)
{
  assert(points.size() >= 3);
  // append each edge
  m_polyBegin = points[0];
  for (int i = 1; i < points.size(); ++i) {
    addSegment(points[i]);
  }
  if (!isClosedShape()) {
    throw new InvalidElementError("Polygon");
  }
}
示例#17
0
  void CPPLexer::includeStatement() {
    // A statement spans until a newline is found (or EOF)

    addSegment(pos, 8, Keyword); // #include
    pos += 8;

    // Skip whitespaces, a quoted string is expected
    while (str->at(pos) == ' ') {
      pos++;
    }

    if (str->at(pos) == '"') {
      size_t segmentStart = pos;
      pos++;

      while (str->at(pos) != '"') {
        if (str->at(pos) == '\n')
          return; // Interrupt if a newline is found
        pos++;
      }
      pos++;

      addSegment(segmentStart, pos - segmentStart, QuotedString);
    }

    if (str->at(pos) == '<') {
      size_t segmentStart = pos;
      pos++;

      while (str->at(pos) != '>') {
        if (str->at(pos) == '\n')
          return; // Interrupt if a newline is found
        pos++;
      }
      pos++;

      addSegment(segmentStart, pos - segmentStart, QuotedString);
    }
  }
示例#18
0
//==============================================================================
void Spline::addSegment(const Eigen::MatrixXd& _coefficients, double _duration)
{
  if (mSegments.empty())
  {
    throw std::logic_error(
        "An explicit start state is required because this trajectory is "
        "empty.");
  }

  auto startState = mStateSpace->createState();
  evaluate(getEndTime(), startState);

  addSegment(_coefficients, _duration, startState);
}
示例#19
0
void Presenter::setupSignals()
{
    con(m_model, &Model::segmentAdded, this,
            [&] (const SegmentModel& segment)
    {
        addSegment(new SegmentView{&segment, m_style, m_view});
    });

    con(m_model, &Model::pointAdded, this,
            [&] (const PointModel& point)
    {
        addPoint(new PointView{&point, m_style, m_view});
    });

    con(m_model, &Model::pointRemoved, this,
            [&] (const Id<PointModel>& m)
    {
        auto& map = m_points.get();
        auto it = map.find(m);
        if(it != map.end()) // TODO should never happen ?
        {
            delete *it;
            map.erase(it);
        }
    });

    con(m_model, &Model::segmentRemoved, this,
            [&] (const Id<SegmentModel>& m)
    {
        auto& map = m_segments.get();
        auto it = map.find(m);
        if(it != map.end()) // TODO should never happen ?
        {
            delete *it;
            map.erase(it);
        }
    });

    con(m_model, &Model::cleared, this,
            [&] ()
    {
        qDeleteAll(m_points.get());
        qDeleteAll(m_segments.get());
        m_points.clear();
        m_segments.clear();
    });

    con(m_model, &Model::curveReset,
        this, &Presenter::modelReset);
}
示例#20
0
  void CPPLexer::defineStatement() {
    // A define statement is a particular one: it might span one or more lines

    addSegment(pos, 7, Keyword); // #define
    pos += 7;

    // Skip whitespaces
    while (str->at(pos) == ' ') {
      pos++;
    }

    // Now we might have something like
    // #define MYMACRO XX
    // or
    // #define MYMACRO(a,b,c..) something
    // or even
    // #define MYMACRO XX \
      //                 multiline
  //

    size_t startSegment = pos;
    while (str->at(pos) != '(' && str->at(pos) != ' ') {
      pos++;
    }
    addSegment(startSegment, pos - startSegment, Identifier);

    // Regular style for all the rest. A macro, even multiline, ends when a newline not preceded
    // by \ is found
    startSegment = pos;
    while (!(str->at(pos) != '\\' && str->at(pos + 1) == '\n')) {
      pos++;
    }
    addSegment(startSegment, pos - startSegment, Normal);
    pos++; // Eat the last character

           // Do not add the \n to the comment (it will be handled outside)
  }
示例#21
0
void ZSparseObject::setVoxelValue(ZStack *stack)
{
#if defined(_USE_OPENVDB_2)

#ifdef _DEBUG_2
  stack->save(GET_TEST_DATA_DIR + "/test.tif");
#endif

  if (stack != NULL && stack->kind() == GREY) {
    int z0 = stack->getOffset().getZ();
    int z1 = z0 + stack->depth() - 1;
    int y0 = stack->getOffset().getY();
    int y1 = y0 + stack->height() - 1;
    int x0 = stack->getOffset().getX();
    int x1 = x0 + stack->width() - 1;

#ifdef _DEBUG_2
  clear();
  for (int y = y0; y <= y1; ++y) {
    addStripe(z0, y);
    addSegment(x0, x1);
  }

#endif

    size_t area = stack->width() * stack->height();
    uint8_t *array = stack->array8();
    for (size_t i = 0; i < getStripeNumber(); ++i) {
      const ZObject3dStripe &stripe = getStripe(i);
      int y = stripe.getY();
      int z = stripe.getZ();
      if (IS_IN_CLOSE_RANGE(z, z0, z1) &&
          IS_IN_CLOSE_RANGE(y, y0, y1)) {
        for (int j = 0; j < stripe.getSegmentNumber(); ++j) {
          int tx0 = imax2(x0, stripe.getSegmentStart(j));
          int tx1 = imin2(x1, stripe.getSegmentEnd(j));

          size_t offset = area * (z - z0) + stack->width() * (y - y0) +
              tx0 - x0;
          for (int x = tx0; x <= tx1; ++x) {
            m_voxelValueObject.setValue(x, y, z, array[offset++]);
          }
        }
      }
    }
    m_voxelValueObject.repack();
  }
#endif
}
示例#22
0
	MusicData loadMusicFromJson(Json::Value mRoot)
	{
		string id				{ mRoot["id"].asString() };
		string fileName			{ mRoot["file_name"].asString() };
		string name			 	{ mRoot["name"].asString() };
		string album	 		{ mRoot["album"].asString() };
		string author 			{ mRoot["author"].asString() };

		auto result = MusicData{id, fileName, name, album, author};

		for (Json::Value segment : mRoot["segments"])
			result.addSegment(segment["time"].asInt());

		return result;
	}
示例#23
0
void Segments::load(const QString &fileName){
    if (fileName.isEmpty())return;
    QFile file(fileName);
    if(!file.open(QIODevice::ReadOnly))
        return;
    QDataStream in(&file);

    segments.clear();

    for(int i =0;!in.atEnd();++i){
        qint32 type;
        in >> type;

        double velocity,endTemperature,duration;
        in >> velocity >> endTemperature >> duration;

        if(type==heating)
            addSegment(new HeatingSegment(0,endTemperature,velocity));
        else if (type==cooling)
            addSegment(new CoolingSegment(0,endTemperature,velocity));
        else if (type==isoterm)
            addSegment(new IsotermalSegment(endTemperature,duration));
    }
}
//*****************************************************************************
// Implement the end of the state machine algorithm, closing the last segment.
//*****************************************************************************
void SelfJoinHandler::doneAddingTables()
{
  // Which state in the state machine are we in?
  switch (state_)
  {
    case ST_SINGLE:
    case ST_UNIQUE:
      addSegment(SelfJoinSegment::UNIQUE_TABLE_SEGMENT);
      break;

    case ST_SELFJOIN:
      addSegment(SelfJoinSegment::SELF_JOIN_SEGMENT);
      break;

    case ST_START:
    case ST_END:
      assertLogAndThrow(CAT_MVMEMO_JOINGRAPH, LL_MVQR_FAIL,
                        FALSE, QRLogicException, 
                        "calling SelfJoinHandler::end() in ST_START or ST_END state.");
      break;
  }

  state_ = ST_END;
}
示例#25
0
  void CPPLexer::multilineComment() {
    size_t segmentStart = pos;

    pos += 2; // Add the '/*' characters

              // Ignore everything until a */ sequence
    while (str->at(pos) != '*' && str->at(pos + 1) != '/')
      pos++;

    // Add '*/'
    pos += 2;

    addSegment(segmentStart, pos - segmentStart, Comment);

    return; // Return to whatever scope we were in
  }
示例#26
0
void dtLocalBoundary::update(dtPolyRef ref, const float* pos, const float collisionQueryRange,
							 dtNavMeshQuery* navquery, const dtQueryFilter* filter)
{
	static const int MAX_SEGS_PER_POLY = DT_VERTS_PER_POLYGON*3;
	
	if (!ref)
	{
		dtVset(m_center, FLT_MAX,FLT_MAX,FLT_MAX);
		m_nsegs = 0;
		m_npolys = 0;
		return;
	}
	
	dtVcopy(m_center, pos);
	
	// First query non-overlapping polygons.
	navquery->findLocalNeighbourhood(ref, pos, collisionQueryRange,
									 filter, m_polys, 0, &m_npolys, MAX_LOCAL_POLYS);
	
	// Secondly, store all polygon edges.
	m_nsegs = 0;
	float segs[MAX_SEGS_PER_POLY*6];
	int nsegs = 0;
	for (int j = 0; j < m_npolys; ++j)
	{
		navquery->getPolyWallSegments(m_polys[j], filter, segs, 0, &nsegs, MAX_SEGS_PER_POLY);
		for (int k = 0; k < nsegs; ++k)
		{
			const float* s = &segs[k*6];
			// Skip too distant segments.
			float tseg;
			const float distSqr = dtDistancePtSegSqr2D(pos, s, s+3, tseg);
			if (distSqr > dtSqr(collisionQueryRange))
				continue;
			addSegment(distSqr, s);
		}
	}
}
void dtCollisionAvoidance::addObtacles(const dtCrowdAgent& ag, const dtCrowdQuery& query)
{
	reset();
	const dtCrowdAgentEnvironment* agEnv = query.getAgentEnvironment(ag.id);

	// Add neighbours as obstacles.
	for (unsigned j = 0; j < agEnv->nbNeighbors; ++j)
	{
		const dtCrowdAgent& nei = *query.getAgent(agEnv->neighbors[j].idx);
		addCircle(nei.position, nei.radius, nei.velocity, nei.desiredVelocity);
	}

	// Append neighbour segments as obstacles.
	for (int j = 0; j < agEnv->boundary.getSegmentCount(); ++j)
	{
		const float* s = agEnv->boundary.getSegment(j);

		if (dtTriArea2D(ag.position, s, s+3) < 0.f)
			continue;

		addSegment(s, s+3);
	}
}
示例#28
0
void ramActorsScene::onActorSetup(const ramActor &actor)
{
    addSegment(new ControlSegment(actor.getName()));
}
示例#29
0
void ramActorsScene::onRigidSetup(const ramRigidBody &rigid)
{
    addSegment(new ControlSegment(rigid.getName()));
}
示例#30
0
  void CPPLexer::declarationOrDefinition() { // A scope declaration or definition
                                             // of a function, class (or some macro-ed stuff e.g. CALLME();) or local variables

                                             // Skip whitespaces
    while (str->at(pos) == ' ') {
      pos++;
    }

    // Handle any keyword or identifier until a terminator character
    bool foundSegment = false;
    size_t startSegment = pos;
    while ((str->at(pos) >= '0' && str->at(pos) <= '9')
      || (str->at(pos) >= 'A' && str->at(pos) <= 'Z')
      || (str->at(pos) >= 'a' && str->at(pos) <= 'z')
      || str->at(pos) == '_') {
      pos++;
    }
    if (pos > startSegment) { // We found something
      Style s = Normal;

      // It might be a reserved keyword
      std::string segment = str->substr(startSegment, pos - startSegment);
      if (m_reservedKeywords.find(segment) != m_reservedKeywords.end()) {
        // For purely aesthetic reasons, style the keywords which aren't private/protected/public
        // in an inner scope with a different style
        if (m_scopesStack.size() > 0 && segment.compare("protected") != 0
          && segment.compare("private") != 0 && segment.compare("public") != 0)
          s = KeywordInnerScope;
        else
          s = Keyword;
        if ((segment.compare("class") == 0 || segment.compare("struct") == 0) &&
          m_classKeywordActiveOnScope == -2 /* No inner class support for now */)
          m_classKeywordActiveOnScope = -1; // We keep track of this since a class scope is *not* a local
                                            // scope, but rather should be treated as the global scope. If we encounter a ';' before any '{', this
                                            // value gets back to -2, i.e. 'no class keyword active'. If we join a scope, this gets set to the
                                            // scope number and from that point forward whenever we're in that scope, no function call can be
                                            // used (only declarations). If we pop out of that function scope, it returns to -2.
      }
      else {

        // Or perhaps a literal (e.g. 11)
        std::regex lit("\\d+[uUlL]?[ull]?[ULL]?[UL]?[ul]?[ll]?[LL]?");
        std::regex lit2("0[xbX][\\da-fA-F]+");
        if (std::regex_match(segment, lit) || std::regex_match(segment, lit2))
          s = Literal;

      }

      // Assign a Keyword or Normal style and later, if we find (, make it a function declaration
      addSegment(startSegment, pos - startSegment, s);
      foundSegment = true;
    }
    // Skip whitespaces and stuff that we're not interested in
    while (str->at(pos) == ' ' || str->at(pos) == '\n') {
      pos++;
    }

    if (str->at(pos) == '(') {

      // Check for the scopes stack and, if we're not in a global scope, mark this as function call.
      // Notice that class member functions aren't marked as function calls but rather as identifiers.
      if (foundSegment && !m_scopesStack.empty() && m_classKeywordActiveOnScope != m_scopesStack.top() &&
        styleDb->styleSegment[styleDb->styleSegment.size() - 1].style != Keyword) {

        styleDb->styleSegment[styleDb->styleSegment.size() - 1].style = FunctionCall;

        // Also set the same style for all the linked previous segments
        for (auto i : m_adaptPreviousSegments)
          styleDb->styleSegment[i].style = FunctionCall;
        m_adaptPreviousSegments.clear();

      }
      else if (foundSegment && (m_scopesStack.empty() || m_classKeywordActiveOnScope == m_scopesStack.top()) &&
        styleDb->styleSegment[styleDb->styleSegment.size() - 1].style != Keyword) {

        styleDb->styleSegment[styleDb->styleSegment.size() - 1].style = Identifier;

        // Also set the same style for all the linked previous segments
        for (auto i : m_adaptPreviousSegments)
          styleDb->styleSegment[i].style = Identifier;
        m_adaptPreviousSegments.clear();
      }

      pos++; // Eat the '('
    }

    if (str->at(pos) == ':' && str->at(pos + 1) == ':') { // :: makes the previous segment part of the new one
      if (styleDb->styleSegment.size() > 0)
        m_adaptPreviousSegments.push_back(static_cast<int>(styleDb->styleSegment.size()) - 1);
    }

    if (foundSegment == false) { // We couldn't find a normal identifier
      if (str->at(pos) == '{') { // Handle entering/exiting scopes
        pos++;
        m_scopesStack.push(static_cast<int>(m_scopesStack.size()));

        if (m_classKeywordActiveOnScope == -1)
          m_classKeywordActiveOnScope = m_scopesStack.top(); // Joined a class scope

      }
      else if (str->at(pos) == '}') {
        pos++;

        if (m_classKeywordActiveOnScope == m_scopesStack.top())
          m_classKeywordActiveOnScope = -2; // Exited a class scope

        m_scopesStack.pop();
      }
      else if (str->at(pos) == '"' || str->at(pos) == '\'') {

        // A quoted string
        char startCharacter = str->at(pos);
        startSegment = pos++;
        while (str->at(pos) != startCharacter)
          ++pos;
        pos++; // Include the terminal character

        addSegment(startSegment, pos - startSegment, QuotedString);
      }
      else {

        // We really can't identify this token, just skip it and assign a regular style

        if (str->at(pos) == ';' && m_classKeywordActiveOnScope == -1)
          m_classKeywordActiveOnScope = -2; // Deactivate the class scope override

        pos++;
      }
    }







    //    // Handle any other keyword or identifier (this could be a function name)
    //    bool foundSegment = false;
    //    size_t startSegment = pos;
    //    while (str->at(pos) != ' ' && str->at(pos) != '(' && str->at(pos) != ';' && str->at(pos) != '{') {
    //      pos++;
    //    }
    //    if (pos > startSegment) { // We found something else
    //      // This might be a declaration if we find another pair of parenthesis or a variable name.
    //      // Assign a Normal style and later, if we find (, make it a function declaration
    //      addSegment(startSegment, pos - startSegment, Normal);
    //      foundSegment = true;
    //    }
    //    // Skip whitespaces and stuff that we're not interested in
    //    while (str->at(pos) == ' ' || str->at(pos) == '\n') {
    //      pos++;
    //    }

    //    if(str->at(pos) == ';') {
    //      pos++;
    //      break; // Hit a terminator
    //    }




    //  // First check if this is a class forward declaration or definition
    //  if (str->substr(pos, 5).compare("class") == 0) { // class
    //    classDeclarationOrDefinition();
    //    return;
    //  }



    //  do { // Continuously parse identifiers/arguments until we hit a terminator

    //    // Handle any other keyword or identifier (this could be a function name)
    //    bool foundSegment = false;
    //    size_t startSegment = pos;
    //    while (str->at(pos) != ' ' && str->at(pos) != '(' && str->at(pos) != ';' && str->at(pos) != '{') {
    //      pos++;
    //    }
    //    if (pos > startSegment) { // We found something else
    //      // This might be a declaration if we find another pair of parenthesis or a variable name.
    //      // Assign a Normal style and later, if we find (, make it a function declaration
    //      addSegment(startSegment, pos - startSegment, Normal);
    //      foundSegment = true;
    //    }
    //    // Skip whitespaces and stuff that we're not interested in
    //    while (str->at(pos) == ' ' || str->at(pos) == '\n') {
    //      pos++;
    //    }

    //    if(str->at(pos) == ';') {
    //      pos++;
    //      break; // Hit a terminator
    //    }

    //    const char *ptr = str->c_str() + pos; // debug

    //    // Handle any (..) section
    //    if (str->at(pos) == '(') {
    //      // Global scope function call

    //      // This also means the previous segment was a declaration or a function call (if we're inside a function)
    //      if (foundSegment && m_scopesStack.empty())
    //        styleDb->styleSegment[styleDb->styleSegment.size()-1].style = Identifier;
    //      else if (foundSegment) // We're in an inner scope
    //        styleDb->styleSegment[styleDb->styleSegment.size()-1].style = FunctionCall;

    //      while (str->at(pos) != ')' && str->at(pos) != ';') {

    //        if (str->at(pos) == '{') {
    //          pos++;
    //          m_scopesStack.push(m_scopesStack.size());
    //        }

    //        if (str->at(pos) == '}') {
    //          pos++;
    //          m_scopesStack.pop();
    //          if (m_scopesStack.empty())
    //            break;
    //        }

    //        pos++;
    //      }
    //      pos++; // Eat the )
    //    }
    //    // Skip whitespaces and stuff that we're not interested in
    //    while (str->at(pos) == ' ' || str->at(pos) == '\n') {
    //      pos++;
    //    }

    //    // There might be a function body at this point, if there is: handle it
    //    if (str->at(pos) == '{') {
    //      pos++;
    //      m_scopesStack.push(m_scopesStack.size());
    //    }

    //    if (str->at(pos) == '}') {
    //      pos++;
    //      m_scopesStack.pop();
    //      if (m_scopesStack.empty())
    //        break;
    //    }

    //  } while (true);

  }