SCM Library
Spherical Cube Map rendering library
 All Classes Files Functions Variables Friends Pages
scm-item.hpp
1 // Copyright (C) 2011-2012 Robert Kooima
2 //
3 // LIBSCM is free software; you can redistribute it and/or modify it under the
4 // terms of the GNU General Public License as published by the Free Software
5 // Foundation; either version 2 of the License, or (at your option) any later
6 // version.
7 //
8 // This program is distributed in the hope that it will be useful, but WITH-
9 // OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 // more details.
12 
13 #ifndef SCM_ITEM_HPP
14 #define SCM_ITEM_HPP
15 
16 //------------------------------------------------------------------------------
17 
23 
24 struct scm_item
25 {
26  int f;
27  long long i;
28 
30 
31  scm_item() : f(-1), i(-1) { }
32 
34 
35  scm_item(int f, long long i) : f( f), i( i) { }
36 
38 
39  bool is_valid() const { return (f >= 0 && i >= 0); }
40 
42 
43  bool operator<(const scm_item& that) const {
44  if (i < that.i) return true;
45  if (i > that.i) return false;
46  return (f < that.f);
47  }
48 };
49 
50 //------------------------------------------------------------------------------
51 
52 #endif
An scm_item is a reference to a specific page in a specific SCM file.
Definition: scm-item.hpp:24
int f
File index.
Definition: scm-item.hpp:26
bool operator<(const scm_item &that) const
Determine the order of two SCM page references.
Definition: scm-item.hpp:43
bool is_valid() const
Return true if this is a valid SCM page reference.
Definition: scm-item.hpp:39
long long i
Page index.
Definition: scm-item.hpp:27
scm_item()
Initialize an invalid SCM page reference.
Definition: scm-item.hpp:31
scm_item(int f, long long i)
Initialize a valid SCM page reference.
Definition: scm-item.hpp:35