KDevelop API Documentation

FileBuffer Class Reference

#include <filebuffer.h>

List of all members.

Public Types

enum  ValueSetMode { VSM_RESET, VSM_APPEND, VSM_EXCLUDE }

Public Member Functions

 FileBuffer ()
 FileBuffer (const QString &fileName)
 ~FileBuffer ()
 Destructor.

void bufferFile (const QString &fileName)
 Loads a file into the buffer.

void appendBufferText (const QStringList &buffer)
void removeComments ()
 removeComments does as name implies.

Caret findInBuffer (const QString &subString, const Caret &startPos, bool nvlToMax=false, bool searchForVariable=false)
 Find next accurance of a substring in the buffer starting at a given caret position Uses searchForVariable flag to determine if we are looking for a variable (like "TARGET") or just a sign (like "=").

void saveBuffer (const QString &filename, const QString &qmakeHeader="")
 Writes buffer to a file.

void dumpBuffer ()
QString pop (int row)
 Pop a line from the buffer Returns: the string being popped.

QStringList popBlock (const Caret &blockStart, const Caret &blockEnd)
QStringList copyBlock (const Caret &blockStart, const Caret &blockEnd)
void setScopeName (const QString &scopeName)
QString getScopeName ()
QStringList getChildScopeNames ()
bool findNextScope (const Caret &pos, Caret &scopeStart, Caret &scopeEnd)
Caret findScopeEnd (Caret pos)
bool handleScopes ()
 Handling qmake scopes means handling two types of scopes 1.

int findChildBuffer (const QString &scopeName)
void makeScope (const QString &scopeString)
 Create a new scope triggering the creation of new subBuffers.

void removeScope (const QString &scopeString, const QString &removeString, QStringList buffer=QStringList())
QStringList getBufferTextInDepth ()
FileBuffergetSubBuffer (QString scopeString="")
 Get the subBuffer representing a certain scope (s1:s2:s3:...:sn).

void splitScopeString (QString scopeString, QString &scopeName, QString &scopeRest)
 Split a scopestring (s1:s2:s3:...:sn) into scopename (s1) and scoperest (s2:s3:...:sn).

QStringList getAllScopeStrings (int depth=0)
QStringList getAllScopeNames (int depth=0)
void removeValues (const QString &variable)
 Remove values for a variable.

bool getValues (const QString &variable, QStringList &plusValues, QStringList &minusValues)
 Get values for a variable.

void setValues (const QString &variable, QString values, FileBuffer::ValueSetMode append=VSM_APPEND, int valuesPerRow=3)
void setValues (const QString &variable, QStringList values, FileBuffer::ValueSetMode append=VSM_APPEND, int valuesPerRow=3)
 Set values for a variable.

bool getAllExcludeValues (const QString &variable, QStringList &minusValues, int depth=0)
void getVariableValueSetModes (const QString &variable, QPtrList< FileBuffer::ValueSetMode > &modes)
 Get all VariableSetModes for a variable.

void filterOutIgnoreValues (QString &line, QStringList &valuesignore)
ValuesIgnoregetValuesIgnore (const QString &variable)

Private Attributes

QString m_scopeName
QStringList m_buffer
FileBufferList m_subBuffers
ValuesIgnoreList m_valuesIgnore


Member Enumeration Documentation

enum FileBuffer::ValueSetMode
 

Enumeration values:
VSM_RESET 
VSM_APPEND 
VSM_EXCLUDE 

Definition at line 37 of file filebuffer.h.

Referenced by getVariableValueSetModes().


Constructor & Destructor Documentation

FileBuffer::FileBuffer  )  [inline]
 

Definition at line 39 of file filebuffer.h.

Referenced by handleScopes(), and makeScope().

FileBuffer::FileBuffer const QString fileName  )  [inline]
 

Definition at line 40 of file filebuffer.h.

References bufferFile().

FileBuffer::~FileBuffer  ) 
 

Destructor.

Definition at line 20 of file filebuffer.cpp.

References m_subBuffers, and m_valuesIgnore.


Member Function Documentation

void FileBuffer::appendBufferText const QStringList buffer  )  [inline]
 

Definition at line 45 of file filebuffer.h.

References appendBufferText(), and m_buffer.

Referenced by appendBufferText(), and handleScopes().

void FileBuffer::bufferFile const QString fileName  ) 
 

Loads a file into the buffer.

Definition at line 414 of file filebuffer.cpp.

References bufferFile(), m_buffer, and removeComments().

Referenced by bufferFile(), FileBuffer(), and TrollProjectWidget::parse().

QStringList FileBuffer::copyBlock const Caret blockStart,
const Caret blockEnd
 

Definition at line 540 of file filebuffer.cpp.

References copyBlock(), m_buffer, Caret::m_idx, and Caret::m_row.

Referenced by copyBlock(), and popBlock().

void FileBuffer::dumpBuffer  ) 
 

Definition at line 497 of file filebuffer.cpp.

References m_buffer.

void FileBuffer::filterOutIgnoreValues QString line,
QStringList valuesignore
 

Definition at line 758 of file filebuffer.cpp.

References filterOutIgnoreValues(), and len.

Referenced by filterOutIgnoreValues(), and getValues().

int FileBuffer::findChildBuffer const QString scopeName  ) 
 

Definition at line 676 of file filebuffer.cpp.

References findChildBuffer(), and m_subBuffers.

Referenced by findChildBuffer(), getSubBuffer(), handleScopes(), makeScope(), and removeScope().

Caret FileBuffer::findInBuffer const QString subString,
const Caret startPos,
bool  nvlToMax = false,
bool  searchForVariable = false
 

Find next accurance of a substring in the buffer starting at a given caret position Uses searchForVariable flag to determine if we are looking for a variable (like "TARGET") or just a sign (like "=").

Returns: a Caret pointing to the position where the substring is found. nvlToMax ? (rowcount+1,0) : (-1,-1) if the substring is not found.

Definition at line 37 of file filebuffer.cpp.

References findInBuffer(), m_buffer, Caret::m_idx, and Caret::m_row.

Referenced by findInBuffer(), findNextScope(), findScopeEnd(), getValues(), getVariableValueSetModes(), handleScopes(), and removeValues().

bool FileBuffer::findNextScope const Caret pos,
Caret scopeStart,
Caret scopeEnd
 

Definition at line 528 of file filebuffer.cpp.

References findInBuffer(), findNextScope(), and findScopeEnd().

Referenced by findNextScope(), and handleScopes().

Caret FileBuffer::findScopeEnd Caret  pos  ) 
 

Definition at line 504 of file filebuffer.cpp.

References findInBuffer(), and findScopeEnd().

Referenced by findNextScope(), and findScopeEnd().

bool FileBuffer::getAllExcludeValues const QString variable,
QStringList minusValues,
int  depth = 0
 

Definition at line 738 of file filebuffer.cpp.

References getAllExcludeValues(), getScopeName(), getValues(), and m_subBuffers.

Referenced by getAllExcludeValues().

QStringList FileBuffer::getAllScopeNames int  depth = 0  ) 
 

Definition at line 701 of file filebuffer.cpp.

References getAllScopeNames(), getScopeName(), and m_subBuffers.

Referenced by getAllScopeNames().

QStringList FileBuffer::getAllScopeStrings int  depth = 0  ) 
 

Definition at line 685 of file filebuffer.cpp.

References getAllScopeStrings(), getScopeName(), and m_subBuffers.

Referenced by getAllScopeStrings().

QStringList FileBuffer::getBufferTextInDepth  ) 
 

Definition at line 481 of file filebuffer.cpp.

References getScopeName(), m_buffer, and m_subBuffers.

Referenced by saveBuffer().

QStringList FileBuffer::getChildScopeNames  ) 
 

Definition at line 729 of file filebuffer.cpp.

References m_subBuffers.

Referenced by TrollProjectWidget::parseScope().

QString FileBuffer::getScopeName  )  [inline]
 

Definition at line 56 of file filebuffer.h.

References m_scopeName.

Referenced by getAllExcludeValues(), getAllScopeNames(), getAllScopeStrings(), and getBufferTextInDepth().

FileBuffer * FileBuffer::getSubBuffer QString  scopeString = ""  ) 
 

Get the subBuffer representing a certain scope (s1:s2:s3:...:sn).

Returns the subbuffer

Definition at line 136 of file filebuffer.cpp.

References findChildBuffer(), getSubBuffer(), m_subBuffers, and splitScopeString().

Referenced by getSubBuffer(), handleScopes(), TrollProjectWidget::parseScope(), and TrollProjectWidget::updateProjectFile().

bool FileBuffer::getValues const QString variable,
QStringList plusList,
QStringList minusList
 

Get values for a variable.

Returns: values as a whitespace separated list. (value_1 value_2 ... value_n)

Definition at line 244 of file filebuffer.cpp.

References filterOutIgnoreValues(), findInBuffer(), getValues(), getValuesIgnore(), m_buffer, Caret::m_idx, Caret::m_row, ValuesIgnore::values, and ValuesIgnore::values_exclude.

Referenced by getAllExcludeValues(), getValues(), TrollProjectWidget::parse(), and TrollProjectWidget::parseScope().

ValuesIgnore * FileBuffer::getValuesIgnore const QString variable  ) 
 

Definition at line 814 of file filebuffer.cpp.

References getValuesIgnore(), m_valuesIgnore, and ValuesIgnore::variable.

Referenced by getValues(), getValuesIgnore(), and setValues().

void FileBuffer::getVariableValueSetModes const QString variable,
QPtrList< FileBuffer::ValueSetMode > &  modes
 

Get all VariableSetModes for a variable.

Definition at line 331 of file filebuffer.cpp.

References findInBuffer(), getVariableValueSetModes(), m_buffer, Caret::m_idx, Caret::m_row, ValueSetMode, VSM_APPEND, VSM_EXCLUDE, and VSM_RESET.

Referenced by getVariableValueSetModes(), and TrollProjectWidget::parse().

bool FileBuffer::handleScopes  ) 
 

Handling qmake scopes means handling two types of scopes 1.

bracket scopes s1:s2:...:sn{ . . . } 2. non-bracketscopes s1:s2:...:sn:v1 = ... [\ ... [\ ...]]

Definition at line 583 of file filebuffer.cpp.

References appendBufferText(), FileBuffer(), findChildBuffer(), findInBuffer(), findNextScope(), getSubBuffer(), m_buffer, Caret::m_idx, Caret::m_row, m_subBuffers, makeScope(), pop(), popBlock(), and setScopeName().

Referenced by TrollProjectWidget::parse().

void FileBuffer::makeScope const QString scopeString  ) 
 

Create a new scope triggering the creation of new subBuffers.

The method is recursive, thus the scope "n1:n2:n3" will create the subbuffer n1, and n1.makeScope is called with "n2:n3" etc.

Definition at line 458 of file filebuffer.cpp.

References FileBuffer(), findChildBuffer(), m_subBuffers, makeScope(), setScopeName(), and splitScopeString().

Referenced by handleScopes(), makeScope(), and TrollProjectWidget::slotCreateScope().

QString FileBuffer::pop int  row  ) 
 

Pop a line from the buffer Returns: the string being popped.

Definition at line 98 of file filebuffer.cpp.

References m_buffer, and pop().

Referenced by handleScopes(), pop(), popBlock(), removeComments(), and removeValues().

QStringList FileBuffer::popBlock const Caret blockStart,
const Caret blockEnd
 

Definition at line 553 of file filebuffer.cpp.

References copyBlock(), m_buffer, Caret::m_idx, Caret::m_row, pop(), and popBlock().

Referenced by handleScopes(), and popBlock().

void FileBuffer::removeComments  ) 
 

removeComments does as name implies.

For the time being this rather drastic cut into manual applied comments is inavoidable.

Definition at line 78 of file filebuffer.cpp.

References m_buffer, and pop().

Referenced by bufferFile().

void FileBuffer::removeScope const QString scopeString,
const QString removeString,
QStringList  buffer = QStringList()
 

Definition at line 827 of file filebuffer.cpp.

References findChildBuffer(), m_subBuffers, removeScope(), and splitScopeString().

Referenced by removeScope(), and TrollProjectWidget::slotRemoveScope().

void FileBuffer::removeValues const QString variable  ) 
 

Remove values for a variable.

Definition at line 388 of file filebuffer.cpp.

References findInBuffer(), Caret::m_row, pop(), and removeValues().

Referenced by removeValues(), TrollProjectWidget::updateInstallObjects(), TrollProjectWidget::updateProjectConfiguration(), and TrollProjectWidget::updateProjectFile().

void FileBuffer::saveBuffer const QString filename,
const QString qmakeHeader = ""
 

Writes buffer to a file.

Definition at line 437 of file filebuffer.cpp.

References getBufferTextInDepth(), length(), and saveBuffer().

Referenced by saveBuffer(), TrollProjectWidget::updateProjectConfiguration(), and TrollProjectWidget::updateProjectFile().

void FileBuffer::setScopeName const QString scopeName  )  [inline]
 

Definition at line 55 of file filebuffer.h.

References m_scopeName, and setScopeName().

Referenced by handleScopes(), makeScope(), and setScopeName().

void FileBuffer::setValues const QString variable,
QStringList  values,
FileBuffer::ValueSetMode  append = VSM_APPEND,
int  valuesPerRow = 3
 

Set values for a variable.

(variable = value_1 value_2 valu_3 ... value_n)

Definition at line 152 of file filebuffer.cpp.

References getValuesIgnore(), m_buffer, setValues(), ValuesIgnore::values, ValuesIgnore::values_exclude, VSM_APPEND, VSM_EXCLUDE, and VSM_RESET.

void FileBuffer::setValues const QString variable,
QString  values,
FileBuffer::ValueSetMode  append = VSM_APPEND,
int  valuesPerRow = 3
[inline]
 

Definition at line 75 of file filebuffer.h.

References setValues().

Referenced by setValues(), TrollProjectWidget::updateInstallObjects(), TrollProjectWidget::updateProjectConfiguration(), and TrollProjectWidget::updateProjectFile().

void FileBuffer::splitScopeString QString  scopeString,
QString scopeName,
QString scopeRest
 

Split a scopestring (s1:s2:s3:...:sn) into scopename (s1) and scoperest (s2:s3:...:sn).

Definition at line 113 of file filebuffer.cpp.

References splitScopeString().

Referenced by getSubBuffer(), makeScope(), removeScope(), and splitScopeString().


Member Data Documentation

QStringList FileBuffer::m_buffer [private]
 

Definition at line 85 of file filebuffer.h.

Referenced by appendBufferText(), bufferFile(), copyBlock(), dumpBuffer(), findInBuffer(), getBufferTextInDepth(), getValues(), getVariableValueSetModes(), handleScopes(), pop(), popBlock(), removeComments(), and setValues().

QString FileBuffer::m_scopeName [private]
 

Definition at line 84 of file filebuffer.h.

Referenced by getScopeName(), and setScopeName().

FileBufferList FileBuffer::m_subBuffers [private]
 

Definition at line 86 of file filebuffer.h.

Referenced by findChildBuffer(), getAllExcludeValues(), getAllScopeNames(), getAllScopeStrings(), getBufferTextInDepth(), getChildScopeNames(), getSubBuffer(), handleScopes(), makeScope(), removeScope(), and ~FileBuffer().

ValuesIgnoreList FileBuffer::m_valuesIgnore [private]
 

Definition at line 87 of file filebuffer.h.

Referenced by getValuesIgnore(), and ~FileBuffer().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:02:02 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003