CTR Pia  4.11.3
Game Communication Engine
util_Api.h
1 /*---------------------------------------------------------------------------*
2  Project: Pia
3  File: util_Api.h
4 
5  Copyright Nintendo. All rights reserved.
6 
7  These coded instructions, statements, and computer programs contain
8  proprietary information of Nintendo of America Inc. and/or Nintendo
9  Company Ltd., and are protected by Federal copyright law. They may
10  not be disclosed to third parties or copied or duplicated in any form,
11  in whole or in part, without the prior written consent of Nintendo.
12  *---------------------------------------------------------------------------*/
13 
14 
15 #pragma once
16 
17 #include <pia/util/util_definitions.h>
18 
19 
20 namespace nn
21 {
22 namespace pia
23 {
24 namespace util
25 {
26 
27 /*!
28 @brief Enumerates the types of handling expected.
29 */
31  {
32  HANDLING_VOID, //!< Invalid value.
33  HANDLING_IGNORABLE, //!< Can be ignored.
34  HANDLING_RETRY, //!< Try to execute again after some time has passed.
35  HANDLING_CLEANUP, //!< A cleanup process is needed.
36  HANDLING_LOGOUT, //!< A logout process is needed.
37  HANDLING_LEAVE, //!< A process for leaving a session is needed.
38  HANDLING_LEAVE_AND_CLEANUP,//!< After leaving a session, execute a cleanup process.
39  HANDLING_RECONNECT, //!< A process for reconnecting is needed.
40  HANDLING_REINITIALIZE, //!< Reinitialization is required.
41  HANDLING_PROGRAMMING_ERROR //!< Programming error. The source code must be revised.
42  };
43 
44 
45 /*!
46 @if CTR_DOC
47 @brief Enumerates the policies for using the Error/EULA applet.
48 @endif
49 @if CAFE_DOC
50 @brief Enumerates the policies for using the error viewer.
51 @endif
52 */
54  {
55  VIEWER_VOID, //!< Invalid value.
56  VIEWER_SHOULD_USE, //!< Supposed to be used.
57  VIEWER_MAY_USE, //!< Okay to use.
58  VIEWER_SHOULD_NOT_USE //!< Do not use.
59  };
60 
61 
62 /*!
63 @brief Determines whether the value is a Pia result.
64 
65 @param[in] r The result value for the determination.
66 
67 @return Returns <tt>true</tt> if the value is a Pia <tt>Result</tt>, and returns <tt>false</tt> otherwise.
68 */
69  bool IsPiaResult(const nn::Result& r);
70 
71 
72 /*!
73 @brief Returns the type of handling expected for the <tt>Result</tt> from Pia.
74 
75 @param[in] r The result value that determines the type of handling.
76 
77 @return Returns an enumerated value for the handling that corresponds to the <tt>Result</tt>.
78 Returns <tt>HANDLING_VOID</tt> if passed a non-Pia <tt>Result</tt> or a <tt>Result</tt> that Pia only uses internally.
79 
80 */
81  enum HandlingType GetHandlingType(const nn::Result& r);
82 
83 
84 /*!
85 @if CTR_DOC
86 @brief Determines whether the Pia <tt>Result</tt> is one for which the Error/EULA applet may be used.
87 @details This API determines whether it is appropriate to pass the network error code that results from feeding the result of a failed Pia API call to <tt>NetworkErrorCodeConverter::Convert</tt> on to the Error/EULA applet.
88 
89 
90 
91 @details For error results returned during local communication, however, do not use the Error/EULA applet, regardless of the return value of this API.
92 
93 @endif
94 @if CAFE_DOC
95 @brief Determines whether the Pia <tt>Result</tt> is one for which the error viewer may be used.
96 @details This API determines whether it is appropriate to pass the network error code that results from feeding the result of a failed Pia API call to <tt>NetworkErrorCodeConverter::Convert</tt> on to the error viewer.
97 
98 
99 
100 @endif
101 
102 @param[in] r The result value for the determination.
103 
104 @return Returns the <tt>ViewerType</tt> that corresponds with the <tt>Result</tt> passed in.
105 Returns <tt>VIEWER_VOID</tt> when a non-Pia <tt>Result</tt> is passed.
106 @see NetworkErrorCodeConverter::Convert
107 */
108  enum ViewerType GetViewerType(const nn::Result& r);
109 
110 
111 /*!
112 @brief Returns a string representation of the Pia <tt>Result</tt>.
113 
114 @param[in] r The Pia <tt>Result</tt> value or <tt>ResultSuccess</tt>.
115 
116 @return Returns that string representation when the Pia <tt>Result</tt> or <tt>ResultSuccess</tt> is passed.
117 Returns an empty string ("") when any other <tt>Result</tt> is passed.
118 */
119  const char* GetResultString(const nn::Result& r);
120 
121 }
122 }
123 } // end of namespace nn::pia::util
ViewerType
Enumerates the policies for using the Error/EULA applet.
Definition: util_Api.h:53
A cleanup process is needed.
Definition: util_Api.h:35
Definition: assert.h:115
A process for reconnecting is needed.
Definition: util_Api.h:39
Do not use.
Definition: util_Api.h:58
Invalid value.
Definition: util_Api.h:55
HandlingType
Enumerates the types of handling expected.
Definition: util_Api.h:30
A logout process is needed.
Definition: util_Api.h:36
const char * GetResultString(const nn::Result &r)
Returns a string representation of the Pia Result.
Supposed to be used.
Definition: util_Api.h:56
Okay to use.
Definition: util_Api.h:57
Try to execute again after some time has passed.
Definition: util_Api.h:34
A process for leaving a session is needed.
Definition: util_Api.h:37
After leaving a session, execute a cleanup process.
Definition: util_Api.h:38
Can be ignored.
Definition: util_Api.h:33
enum ViewerType GetViewerType(const nn::Result &r)
Determines whether the Pia Result is one for which the Error/EULA applet may be used.
Reinitialization is required.
Definition: util_Api.h:40
Invalid value.
Definition: util_Api.h:32
Programming error. The source code must be revised.
Definition: util_Api.h:41
enum HandlingType GetHandlingType(const nn::Result &r)
Returns the type of handling expected for the Result from Pia.
bool IsPiaResult(const nn::Result &r)
Determines whether the value is a Pia result.