aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Position.h
blob: 258eb177f6b774a65dc30250d59131d3109c94f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Scintilla source code edit control
/** @file Position.h
 ** Defines global type name Position in the Sci internal namespace.
 **/
// Copyright 2015 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.

#ifndef POSITION_H
#define POSITION_H

/**
 * A Position is a position within a document between two characters or at the beginning or end.
 * Sometimes used as a character index where it identifies the character after the position.
 */

namespace Sci {

typedef int Position;
typedef int Line;

// A later version (4.x) of this file may:
//#if defined(SCI_LARGE_FILE_SUPPORT)
//typedef std::ptrdiff_t Position;
// or may allow runtime choice between different position sizes.

const Position invalidPosition = -1;

inline int clamp(int val, int minVal, int maxVal) {
	if (val > maxVal)
		val = maxVal;
	if (val < minVal)
		val = minVal;
	return val;
}

}

#endif