edbee - Qt Editor Library v0.11.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
util.h
Go to the documentation of this file.
1// edbee - Copyright (c) 2012-2025 by Rick Blommers and contributors
2// SPDX-License-Identifier: MIT
3
4#pragma once
5
6#include "edbee/exports.h"
7
8#include <QList>
9
10class QString;
11
12namespace edbee {
13
19public:
20 QString convertTabsToSpaces( const QString& str, int tabSize );
21 QList<int> tabColumnOffsets( const QString& str, int tabSize );
22
23
31 template<typename T>
32 bool intersection( T begin1, T end1, T begin2, T end2, bool exclusive=false, T* resultBegin=0, T* resultEnd=0 )
33 {
34 if( exclusive ) {
35 if( end1 <= begin2 ) return false;
36 if( end2 <= begin1 ) return false;
37 } else {
38 if( end1 < begin2 ) return false;
39 if( end2 < begin1 ) return false;
40 }
41
42 // assign the result
43 if( resultBegin ) { *resultBegin = qMax(begin1,begin2); }
44 if( resultEnd ) { *resultEnd = qMin(end1,end2); }
45 return true;
46 }
47};
48
49} // edbee
A global utiltity class. The purpose of this class is to put 'global' function that don't quite fit o...
Definition util.h:18
QList< int > tabColumnOffsets(const QString &str, int tabSize)
This method returns all tab-column offsets of the given string.
Definition util.cpp:46
bool intersection(T begin1, T end1, T begin2, T end2, bool exclusive=false, T *resultBegin=0, T *resultEnd=0)
This method calculates 2 intersections between 2 ranges.
Definition util.h:32
QString convertTabsToSpaces(const QString &str, int tabSize)
Converst all tabs to sapces of the given string, using the current tab/indent settings It converts "\...
Definition util.cpp:19
#define EDBEE_EXPORT
Definition exports.h:15
QT Acessibility has an issue with reporting blank lines between elements lines. defining 'WINDOWS_EMP...
Definition commentcommand.cpp:20