InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ScriptReturnData.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Jonathan W. Brown
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 
24 #ifndef __ScriptReturnData__
25 #define __ScriptReturnData__
26 
27 #include "ScriptData.h"
28 
33 {
34 public:
35  typedef object_type data_type ;
36 
37  explicit ScriptReturnData();
43  explicit ScriptReturnData( const ScriptID requestID ) ;
50  ScriptReturnData( const ScriptID requestID, ScriptData returnValue ) ;
51 
57  ScriptReturnData( const ScriptID requestID, const ErrorCode errorCode ) ;
62 
66  ScriptID GetRequestID() const { return fRequestID ; }
67 
71  ScriptData GetReturnValue() const { return fReturnValue ; }
72 
76  ErrorCode GetErrorCode() const { return fErrorCode ; }
77 
83  PMString GetErrorString() const ;
84 
89  void SetErrorString( PMString errorString ) { swap( fErrorString, errorString ) ; }
90 
93  friend inline void swap( ScriptReturnData& left, ScriptReturnData& right )
94  {
95  std::swap(left.fRequestID, right.fRequestID);
96  swap(left.fReturnValue, right.fReturnValue);
97  std::swap(left.fErrorCode, right.fErrorCode);
98  swap(left.fErrorString, right.fErrorString);
99  std::swap(left.fErrorInfo, right.fErrorInfo);
100  }
101 
105  : fRequestID(other.fRequestID), fReturnValue(other.fReturnValue),
106  fErrorCode(other.fErrorCode), fErrorString(other.fErrorString), fErrorInfo(other.fErrorInfo)
107  {
108  }
109 
112  ScriptReturnData(adobe::move_from<ScriptReturnData> other)
113  : fRequestID(other.source.fRequestID), fReturnValue(adobe::move(other.source.fReturnValue)),
114  fErrorCode(other.source.fErrorCode), fErrorString(adobe::move(other.source.fErrorString))
115  {
116  std::swap(fErrorInfo, other.source.fErrorInfo);
117  }
118 
122  { swap(*this, other); return *this; }
123 
124 protected:
129  void CheckGlobalErrorCode() ;
130 
131 private:
132  ScriptID fRequestID ;
133  ScriptData fReturnValue ;
134  ErrorCode fErrorCode ;
135  mutable PMString fErrorString ;
136  InterfacePtr<IPMUnknown> fErrorInfo ;
137 } ;
138 
139 typedef adobe::vector<ScriptReturnData> ScriptReturnDataList ;
140 
141 #ifdef ID_ENABLE_DEBUGGING
142 
144  PMString GetAsString( const ScriptReturnData& srd, const RequestContext& context ) ;
146  PMString GetAsString( const ScriptReturnDataList& srdl, const RequestContext& context ) ;
147 
148 #endif
149 
150 #endif