p4ruby 2022.1.2359956-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,158 @@
1
+ /*******************************************************************************
2
+
3
+ Copyright (c) 2001-2008, Perforce Software, Inc. All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright
12
+ notice, this list of conditions and the following disclaimer in the
13
+ documentation and/or other materials provided with the distribution.
14
+
15
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
+ ARE DISCLAIMED. IN NO EVENT SHALL PERFORCE SOFTWARE, INC. BE LIABLE FOR ANY
19
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
+
26
+ *******************************************************************************/
27
+
28
+ /*******************************************************************************
29
+ * Name : clientuserruby.h
30
+ *
31
+ * Author : Tony Smith <tony@perforce.com> or <tony@smee.org>
32
+ *
33
+ * Description : Ruby bindings for the Perforce API. User interface class
34
+ * for getting Perforce results into Ruby.
35
+ *
36
+ ******************************************************************************/
37
+
38
+ /*******************************************************************************
39
+ * ClientUserRuby - the user interface part. Gets responses from the Perforce
40
+ * server, and converts the data to Ruby form for returning to the caller.
41
+ ******************************************************************************/
42
+ class SpecMgr;
43
+ class ClientProgress;
44
+
45
+ class ClientUserRuby: public ClientUser, public ClientSSO, public KeepAlive {
46
+ public:
47
+ ClientUserRuby(SpecMgr *s);
48
+
49
+ // Client User methods overridden here
50
+ void OutputText(const char *data, int length);
51
+ void Message(Error *e);
52
+ void OutputStat(StrDict *values);
53
+ void OutputBinary(const char *data, int length);
54
+ void InputData(StrBuf *strbuf, Error *e);
55
+ void Diff(FileSys *f1, FileSys *f2, int doPage, char *diffFlags, Error *e);
56
+ void Prompt(const StrPtr &msg, StrBuf &rsp, int noEcho, Error *e);
57
+
58
+ int Resolve(ClientMerge *m, Error *e);
59
+ int Resolve(ClientResolveA *m, int preview, Error *e);
60
+
61
+ ClientProgress* CreateProgress( int type );
62
+ int ProgressIndicator();
63
+
64
+ void Finished();
65
+
66
+ // Local methods
67
+ VALUE SetInput(VALUE i);
68
+ void SetCommand(const char *c) {
69
+ cmd = c;
70
+ }
71
+ void SetApiLevel(int l);
72
+ void SetTrack(bool t) {
73
+ track = t;
74
+ }
75
+
76
+ P4Result& GetResults() {
77
+ return results;
78
+ }
79
+ int ErrorCount();
80
+ void Reset();
81
+
82
+ void RaiseRubyException();
83
+
84
+ // GC support
85
+ void GCMark();
86
+
87
+ // Debugging support
88
+ void SetDebug(int d) {
89
+ debug = d;
90
+ }
91
+
92
+ // Handler support
93
+ VALUE SetHandler(VALUE handler);
94
+ VALUE GetHandler() {
95
+ return handler;
96
+ }
97
+
98
+ // Progress API support
99
+ VALUE SetProgress( VALUE p );
100
+ VALUE GetProgress() {
101
+ return progress;
102
+ }
103
+
104
+ // SSO handler support
105
+
106
+ virtual ClientSSOStatus Authorize( StrDict &vars, int maxLength, StrBuf &result );
107
+ VALUE EnableSSO( VALUE e );
108
+ VALUE SSOEnabled();
109
+ VALUE SetSSOPassResult( VALUE i );
110
+ VALUE GetSSOPassResult();
111
+ VALUE SetSSOFailResult( VALUE i );
112
+ VALUE GetSSOFailResult();
113
+ VALUE GetSSOVars();
114
+ VALUE SetRubySSOHandler( VALUE handler );
115
+ VALUE GetRubySSOHandler() {
116
+ return ssoHandler;
117
+ }
118
+
119
+ // override from KeepAlive
120
+ virtual int IsAlive() {
121
+ return alive;
122
+ }
123
+
124
+ private:
125
+ VALUE MkMergeInfo(ClientMerge *m, StrPtr &hint);
126
+ VALUE MkActionMergeInfo(ClientResolveA *m, StrPtr &hint);
127
+ void ProcessOutput(const char * method, VALUE data);
128
+ void ProcessMessage(Error * e);
129
+ bool CallOutputMethod(const char * method, VALUE data);
130
+ VALUE SetSSOResult( VALUE i );
131
+ ClientSSOStatus CallSSOMethod(VALUE vars, int maxLength, StrBuf &result);
132
+
133
+ private:
134
+ StrBuf cmd;
135
+ SpecMgr * specMgr;
136
+ P4Result results;
137
+ VALUE input;
138
+ VALUE mergeData;
139
+ VALUE mergeResult;
140
+ VALUE handler;
141
+ VALUE cOutputHandler;
142
+ VALUE progress;
143
+ VALUE cProgress;
144
+ VALUE cSSOHandler;
145
+ int debug;
146
+ int apiLevel;
147
+ int alive;
148
+ int rubyExcept;
149
+ bool track;
150
+
151
+ // SSO handler support
152
+ int ssoEnabled;
153
+ int ssoResultSet;
154
+ StrBufDict ssoVars;
155
+ VALUE ssoResult;
156
+ VALUE ssoHandler;
157
+ };
158
+