Click here to Skip to main content
15,885,278 members
Articles / Database Development / SQL Server

A scripted SQL query generation framework with IDE: SQLpp (v1.4)

Rate me:
Please Sign up or sign in to vote.
4.98/5 (47 votes)
12 Sep 200311 min read 410.8K   5.4K   133  
A helper framework for generation of SQL queries in C++ and Lua
// Scintilla source code edit control
/** @file DocumentAccessor.h
 ** Implementation of BufferAccess and StylingAccess on a Scintilla
 ** rapid easy access to contents of a Scintilla.
 **/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.

class Document;

/**
 */
class DocumentAccessor : public Accessor {
	// Private so DocumentAccessor objects can not be copied
	DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {}
	DocumentAccessor &operator=(const DocumentAccessor &) { return *this; }

protected:
	Document *pdoc;
	PropSet &props;
	WindowID id;
	int lenDoc;

	char styleBuf[bufferSize];
	int validLen;
	char chFlags;
	char chWhile;
	unsigned int startSeg;
	int startPosStyling;

	bool InternalIsLeadByte(char ch);
	void Fill(int position);

public:
	DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) : 
		Accessor(), pdoc(pdoc_), props(props_), id(id_),
		lenDoc(-1), validLen(0), chFlags(0), chWhile(0), 
		startSeg(0), startPosStyling(0) {
	}
	~DocumentAccessor();
	bool Match(int pos, const char *s);
	char StyleAt(int position);
	int GetLine(int position);
	int LineStart(int line);
	int LevelAt(int line);
	int Length();
	void Flush();
	int GetLineState(int line);
	int SetLineState(int line, int state);
	int GetPropertyInt(const char *key, int defaultValue=0) { 
		return props.GetInt(key, defaultValue); 
	}
	char *GetProperties() {
		return props.ToString();
	}
	WindowID GetWindow() { return id; }

	void StartAt(unsigned int start, char chMask=31);
	void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; };
	unsigned int GetStartSegment() { return startSeg; }
	void StartSegment(unsigned int pos);
	void ColourTo(unsigned int pos, int chAttr);
	void SetLevel(int line, int level);
	int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0);
};

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Engineer
United States United States
Jonathan de Halleux is Civil Engineer in Applied Mathematics. He finished his PhD in 2004 in the rainy country of Belgium. After 2 years in the Common Language Runtime (i.e. .net), he is now working at Microsoft Research on Pex (http://research.microsoft.com/pex).

Comments and Discussions