InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
FormatID.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Steve Pellegrin
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //
23 // Purpose of Interface:
24 // Specifies format numbers for file format conversion.
25 //
26 //========================================================================================
27 
28 #ifndef __FormatID__
29 #define __FormatID__
30 
31 // ----- Interfaces -----
32 
33 #include "IPMStream.h"
34 
35 
36 class FormatID
37 {
38 public:
39  typedef base_type data_type;
40 
41  FormatID() :
42  fMajorNumber(0),
43  fMinorNumber(0)
44  {}
45  FormatID(int32 majorNumber, int32 minorNumber) :
46  fMajorNumber(majorNumber),
47  fMinorNumber(minorNumber)
48  {}
49  FormatID(const FormatID &other) :
50  fMajorNumber(other.fMajorNumber),
51  fMinorNumber(other.fMinorNumber)
52  {}
53  FormatID(IPMStream *s) :
54  fMajorNumber(0),
55  fMinorNumber(0)
56  {
57  if (s->IsReading()) ReadWrite(s);
58  }
59 
60  int32 GetMajorVersion() const
61  { return fMajorNumber; }
62  void SetMajorVersion(int32 m)
63  {fMajorNumber =m;}
64  int32 GetMinorVersion() const
65  { return fMinorNumber; }
66  void SetMinorVersion(int32 m)
67  {fMinorNumber = m;}
68 
69  bool16 IsUnknown() const
70  {return ((fMajorNumber == 0) && (fMinorNumber == 0));}
71  void SetUnknown()
72  {fMajorNumber = fMinorNumber = 0;}
73 
74  bool16 operator <(const FormatID& other) const
75  {return (fMajorNumber == other.fMajorNumber) ? (fMinorNumber < other.fMinorNumber) : (fMajorNumber < other.fMajorNumber);}
76  bool16 operator >(const FormatID& other) const
77  {return (fMajorNumber == other.fMajorNumber) ? (fMinorNumber > other.fMinorNumber) : (fMajorNumber > other.fMajorNumber);}
78  bool16 operator ==(const FormatID& other) const
79  {return (fMajorNumber == other.fMajorNumber) && (fMinorNumber == other.fMinorNumber);}
80  bool16 operator !=(const FormatID& other) const
81  {return !(*this == other);}
82  bool16 operator <=(const FormatID& other) const
83  {return !(*this > other);}
84  bool16 operator >=(const FormatID& other) const
85  {return !(*this < other);}
86 
87  void ReadWrite(IPMStream *s)
88  {s->XferInt32(fMajorNumber);
89  s->XferInt32(fMinorNumber);}
90 
91 private:
92  int32 fMajorNumber;
93  int32 fMinorNumber;
94 };
95 
96 #endif // __FormatID__
97