buildtools/qmake/filebuffer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
#ifndef _FILEBUFFER_H_
00013
#define _FILEBUFFER_H_
00014
00015
#include <qstring.h>
00016
#include <qstringlist.h>
00017
#include <qptrlist.h>
00018
#include <qfile.h>
00019
#include "caret.h"
00020
00021 class ValuesIgnore
00022 {
00023
public:
00024 QString variable;
00025 QStringList values;
00026 QStringList values_exclude;
00027 };
00028
00029 typedef QValueList<ValuesIgnore*> ValuesIgnoreList;
00030
00031
class FileBuffer;
00032 typedef QValueList<FileBuffer*> FileBufferList;
00033
00034 class FileBuffer
00035 {
00036
public:
00037 enum ValueSetMode {
VSM_RESET,
VSM_APPEND,
VSM_EXCLUDE};
00038
00039 FileBuffer() {}
00040 FileBuffer(
const QString &fileName) {
bufferFile(fileName);}
00041
~FileBuffer();
00042
00043
00044
void bufferFile(
const QString &fileName);
00045 void appendBufferText(
const QStringList &buffer) {
m_buffer+=buffer;}
00046
void removeComments();
00047
Caret findInBuffer(
const QString &subString,
const Caret& startPos,
bool nvlToMax=
false,
bool searchForVariable =
false);
00048
void saveBuffer(
const QString &filename,
const QString &qmakeHeader=
"");
00049
void dumpBuffer();
00050
QString pop(
int row);
00051
QStringList popBlock(
const Caret &blockStart,
const Caret &blockEnd);
00052
QStringList copyBlock(
const Caret &blockStart,
const Caret &blockEnd);
00053
00054
00055 void setScopeName(
const QString &scopeName) {
m_scopeName=scopeName;}
00056 QString getScopeName() {
return m_scopeName;}
00057
QStringList getChildScopeNames();
00058
bool findNextScope(
const Caret &pos,
Caret& scopeStart,
Caret& scopeEnd);
00059
Caret findScopeEnd(
Caret pos);
00060
00061
00062
bool handleScopes();
00063
int findChildBuffer(
const QString &scopeName);
00064
void makeScope(
const QString &scopeString);
00065
void removeScope(
const QString &scopeString,
const QString &removeString,
QStringList buffer =
QStringList());
00066
QStringList getBufferTextInDepth();
00067
FileBuffer* getSubBuffer(
QString scopeString=
"");
00068
void splitScopeString(
QString scopeString,
QString &scopeName,
QString &scopeRest);
00069
QStringList getAllScopeStrings(
int depth=0);
00070
QStringList getAllScopeNames(
int depth=0);
00071
00072
00073
void removeValues(
const QString &variable);
00074
bool getValues(
const QString &variable,
QStringList &plusValues,
QStringList &minusValues);
00075 void setValues(
const QString &variable,
QString values,FileBuffer::ValueSetMode append=VSM_APPEND,
int valuesPerRow=3)
00076 {setValues(variable,QStringList::split(
' ',values),append,valuesPerRow);}
00077
void setValues(
const QString &variable,
QStringList values,FileBuffer::ValueSetMode append=VSM_APPEND,
int valuesPerRow=3);
00078
bool getAllExcludeValues(
const QString &variable,
QStringList &minusValues,
int depth=0);
00079
void getVariableValueSetModes(
const QString &variable,
QPtrList<FileBuffer::ValueSetMode> &modes);
00080
void filterOutIgnoreValues(
QString& line,
QStringList& valuesignore);
00081
ValuesIgnore* getValuesIgnore(
const QString &variable);
00082
00083
private:
00084 QString m_scopeName;
00085 QStringList m_buffer;
00086 FileBufferList m_subBuffers;
00087 ValuesIgnoreList m_valuesIgnore;
00088
00089 };
00090
00091
#endif
00092
This file is part of the documentation for KDevelop Version 3.0.4.