Nintendo 3DS Miiverse Library  1.3.2
(OLV/Olive)
olv_TypesStartPortalApp.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*
2 Project: OLV
3 File: olv_TypesStartPortalApp.h
4 
5 Copyright (C) 2009-2013 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 #ifndef __OLV_TYPES_START_PORTALAPP_H_
15 #define __OLV_TYPES_START_PORTALAPP_H_
16 
17 /*! @file
18 @brief Declaration of types related to starting the OLV Miiverse application.
19 */
20 
21 #include <nn/config.h>
22 #include <nn/types.h>
23 #include <nn/olv/olv_Const.h>
24 
25 /// <span>nn</span>
26 namespace nn {
27 
28 /// <span>olv</span>
29 namespace olv {
30 
31 namespace internal
32 {
33 class Main;
34 }
35 
36 /*/* @defgroup class Classes
37  * @{
38  */
39 
40 /*!
41 @brief Represents the parameters when starting the Miiverse application.
42 */
44 {
45 public:
46 
47  /*!
48 @brief Modes that can be specified in the <tt>SetMode</tt> function.
49  */
50  enum {
51  MODE_NONE = 0, //!< The default mode.
52  MODE_START_COMMUNITY = MODE_VALUE_START_COMMUNITY, //!< The mode to specify when showing a community.
53  MODE_START_POST = MODE_VALUE_START_POST, //!< The mode to specify when showing a post.
54  MODE_START_USER = MODE_VALUE_START_USER //!< The mode to specify when showing a user.
55  };
56 
57  /*!
58 @brief Flags that can be specified in the <tt>@ref SetFlags</tt> function.
59  */
60  enum {
61  FLAG_NONE = 0 //!< This is the state when no flags are specified.
62  };
63 
64  /*!
65 @brief Constant.
66  */
67  enum {
68  COMMON_DATA_MAX_NUM = 256 //!< The maximum amount of common data that can added.
69  };
70 
71  /*!
72 @brief Instantiates the object.
73  */
75 
76  /*!
77 @brief Reverts parameters to their initial state.
78  */
79  void Reset();
80 
81  /*!
82 @brief Sets the mode.
83 
84 Specifying this option is not required.
85 
86 @param[in] mode The mode (<tt>MODE_*</tt>).
87  */
88  void SetMode(u32 mode);
89 
90  /*!
91 @brief Sets flags.
92 
93 This is for future expansion. It is not used currently.
94 
95 @param[in] flags Flags (<tt>FLAG_*</tt>).
96  */
97  void SetFlags(u32 flags);
98 
99  /*!
100 @brief Sets the post ID.
101 
102 You must specify this option when <tt>@ref MODE_START_POST</tt> is specified for the <tt>@ref SetMode</tt> function. <br />
103 Note that the only value stored is the address, so the data must remain valid until the call to the <tt>@ref nn::olv::StartPortalApp</tt> function ends.
104 
105 @param[in] postId The post ID. <br />
106 The maximum number of characters that can be specified is <tt>@ref nn::olv::POST_ID_BUFF_LENGTH - 1</tt>.
107  */
108  void SetPostId(const char* postId);
109 
110  /*!
111 @brief Sets the community ID.
112 
113 You can specify this option when <tt>@ref MODE_START_COMMUNITY</tt> is specified for the <tt>@ref SetMode</tt> function. If not specified, the general community is shown by default.
114 
115 @param[in] communityId The community ID.
116  */
117  void SetCommunityId(u32 communityId);
118 
119  /*!
120 @brief Sets the principal ID.
121 
122 You must specify this option when <tt>@ref MODE_START_USER</tt> is specified for the <tt>@ref SetMode</tt> function.
123 
124 @param[in] userPid The principal ID.
125  */
126  void SetUserPid(u32 userPid);
127 
128  /*!
129 @brief Sets the topic tag.
130 
131 Specifying this option is not required. <br />
132 You can only specify this option when <tt>@ref MODE_START_COMMUNITY</tt> is specified for the <tt>@ref SetMode</tt> function. <br />
133 When specified, only posts with the specified topic tag are shown. <br />
134 Note that the only value stored is the address, so the data must remain valid until the call to the <tt>@ref nn::olv::StartPortalApp</tt> function ends.
135 
136 @param[in] topicTag The topic tag. <br />
137 Use UTF-16LE for the encoding. <br />
138 The maximum number of characters that can be specified is <tt>@ref nn::olv::TOPIC_TAG_MAX_LENGTH</tt>.
139  */
140  void SetTopicTag(const wchar_t* topicTag);
141 
142  /*!
143 @brief Adds common data.
144 
145 Specifying this option is not required. <br />
146 Under normal use conditions this specification is not required. <br />
147 The maximum amount that can be added is <tt>nn::olv::StartPortalAppParam::COMMON_DATA_MAX_NUM</tt>. <br />
148 Note that the only value stored is the address, so the data must remain valid until the call to the <tt>@ref nn::olv::StartPortalApp</tt> function ends.
149 
150 @param[in] type The type of the common data (COMMON_DATA_TYPE_*).
151 @param[in] data The common data.
152 @param[in] dataSize The size of the common data.
153  */
154  void SetCommonData(u32 type, const u8* data, u32 dataSize);
155 
156  /*!
157 @brief Gets the size of the working buffer used by the <tt>@ref nn::olv::StartPortalApp</tt> function.
158 
159 Call this function after all of the various parameters have been specified, with the exception of the <tt>@ref SetWork</tt> function. <br />
160 - The required size will increase according to the specified parameters.
161 
162 @return Returns the size of the working buffer.
163  */
164  u32 GetWorkSize() const;
165 
166  /*!
167 @brief Sets the size of the working buffer used by the <tt>@ref nn::olv::StartPortalApp</tt> function.
168 
169 You must specify this option. <br />
170 Specify a buffer of at least the size obtained with the <tt>GetWorkSize</tt> function. <br />
171 Device memory cannot be specified for this buffer. <br />
172 This buffer cannot be destroyed at the point the call to the <tt>@ref nn::olv::StartPortalApp</tt> function finishes. See the description of the <tt>@ref nn::olv::StartPortalApp</tt> function.
173 
174 @param[in] work The working buffer.
175 @param[in] workSize The size of the working buffer.
176  */
177  void SetWork(u8* work, u32 workSize);
178 
179 private:
180 
181  u32 m_Mode;
182  u32 m_Flags;
183  u8* m_Work;
184  u32 m_WorkSize;
185  u32 m_CommonDataNum;
186  u32 m_CommonDataType[COMMON_DATA_MAX_NUM];
187  const u8* m_CommonData[COMMON_DATA_MAX_NUM];
188  u32 m_CommonDataSize[COMMON_DATA_MAX_NUM];
189  bool m_CommonDataIsValue[COMMON_DATA_MAX_NUM];
190  u8 m_Reserved[4096-3348];
191 
192  friend class nn::olv::internal::Main;
193 };
194 
195 /** @} */
196 
197 } // namespace olv
198 } // namespace nn
199 #endif