mirror of
https://gitee.com/openharmony/ability_dmsfwk
synced 2024-11-27 08:30:38 +00:00
modified namespace
Signed-off-by: xinking129 <xinxin13@huawei.com>
This commit is contained in:
parent
b93f864514
commit
74c4de115e
@ -25,6 +25,7 @@ config("distributed_sched_config") {
|
||||
visibility += [ "./test/*" ]
|
||||
include_dirs = [
|
||||
"include",
|
||||
"include/distributedWant",
|
||||
"//third_party/json/include",
|
||||
]
|
||||
defines = []
|
||||
|
@ -13,17 +13,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_ABILITY_BASE_DISTRIBUTED_OPERATION_H
|
||||
#define OHOS_ABILITY_BASE_DISTRIBUTED_OPERATION_H
|
||||
#ifndef OHOS_DISTRIBUTEDWANT_OPERATION_H
|
||||
#define OHOS_DISTRIBUTEDWANT_OPERATION_H
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "parcel.h"
|
||||
#include "string_ex.h"
|
||||
#include "uri.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace DistributedSchedule {
|
||||
class DistributedOperationBuilder;
|
||||
|
||||
class DistributedOperation : public Parcelable {
|
||||
@ -150,14 +149,14 @@ private:
|
||||
* @param uri Indicates uri object to set.
|
||||
* @return -
|
||||
*/
|
||||
void SetUri(const Uri& uri);
|
||||
void SetUri(const OHOS::Uri& uri);
|
||||
|
||||
/**
|
||||
* @description: Gets a uri in this DistributedOperation.
|
||||
* @param uri Indicates uri object to set.
|
||||
* @return Returns a uri in this DistributedOperation.
|
||||
*/
|
||||
Uri& GetUri(const Uri& uri);
|
||||
OHOS::Uri& GetUri(const OHOS::Uri& uri);
|
||||
|
||||
/**
|
||||
* @description: Sets the value of the abilityName attribute included in this DistributedOperation.
|
||||
@ -201,7 +200,7 @@ private:
|
||||
std::string moduleName_;
|
||||
std::vector<std::string> entities_;
|
||||
unsigned int flags_;
|
||||
Uri uri_;
|
||||
OHOS::Uri uri_;
|
||||
|
||||
// no object in parcel
|
||||
static constexpr int VALUE_NULL = -1;
|
||||
@ -210,7 +209,7 @@ private:
|
||||
|
||||
bool ReadFromParcel(Parcel& parcel);
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OHOS_ABILITY_BASE_DISTRIBUTED_OPERATION_H
|
||||
#endif // OHOS_DISTRIBUTEDWANT_OPERATION_H
|
@ -13,17 +13,16 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_ABILITY_BASE_DISTRIBUTED_OPERATION_BUILDER_H
|
||||
#define OHOS_ABILITY_BASE_DISTRIBUTED_OPERATION_BUILDER_H
|
||||
#ifndef OHOS_DISTRIBUTEDWANT_OPERATION_BUILDER_H
|
||||
#define OHOS_DISTRIBUTEDWANT_OPERATION_BUILDER_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "uri.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace DistributedSchedule {
|
||||
class DistributedOperation;
|
||||
class DistributedOperationBuilder {
|
||||
public:
|
||||
@ -70,7 +69,7 @@ public:
|
||||
* @description: Sets a Uri in an DistributedOperationBuilder.
|
||||
* @return Returns this DistributedOperationBuilder object containing the Uri.
|
||||
*/
|
||||
DistributedOperationBuilder& WithUri(const Uri& uri);
|
||||
DistributedOperationBuilder& WithUri(const OHOS::Uri& uri);
|
||||
std::shared_ptr<DistributedOperation> build();
|
||||
|
||||
private:
|
||||
@ -80,9 +79,9 @@ private:
|
||||
std::string deviceId_ = "";
|
||||
std::vector<std::string> entities_ = {};
|
||||
unsigned int flags_ = 0;
|
||||
Uri uri_;
|
||||
OHOS::Uri uri_;
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OHOS_ABILITY_BASE_DISTRIBUTED_OPERATION_BUILDER_H
|
||||
#endif // OHOS_DISTRIBUTEDWANT_OPERATION_BUILDER_H
|
@ -13,13 +13,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_AAFWK_DISTRIBUTED_WANT_H
|
||||
#define OHOS_AAFWK_DISTRIBUTED_WANT_H
|
||||
#ifndef OHOS_DISTRIBUTEDWANT_WANT_H
|
||||
#define OHOS_DISTRIBUTEDWANT_WANT_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "distributedWant/distributed_operation.h"
|
||||
#include "distributedWant/distributed_want_params.h"
|
||||
#include "element_name.h"
|
||||
@ -28,10 +27,10 @@
|
||||
#include "uri.h"
|
||||
#include "want.h"
|
||||
|
||||
using DistributedOperation = OHOS::AAFwk::DistributedOperation;
|
||||
using DistributedOperation = OHOS::DistributedSchedule::DistributedOperation;
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace DistributedSchedule {
|
||||
class DistributedWant final : public Parcelable {
|
||||
public:
|
||||
/**
|
||||
@ -115,7 +114,7 @@ public:
|
||||
*/
|
||||
DistributedWant(const DistributedWant& want);
|
||||
DistributedWant& operator=(const DistributedWant&);
|
||||
DistributedWant(const Want& want);
|
||||
DistributedWant(const AAFwk::Want& want);
|
||||
|
||||
/**
|
||||
* @description: Sets a flag in a DistributedWant.
|
||||
@ -203,7 +202,7 @@ public:
|
||||
* @description: Obtains the description of a URI in a DistributedWant.
|
||||
* @return Returns the URI description in the DistributedWant.
|
||||
*/
|
||||
Uri GetUri() const;
|
||||
OHOS::Uri GetUri() const;
|
||||
|
||||
/**
|
||||
* @description: Obtains the string representation of the URI in this DistributedWant.
|
||||
@ -223,7 +222,7 @@ public:
|
||||
* @param uri Indicates the URI description.
|
||||
* @return Returns this DistributedWant object containing the URI.
|
||||
*/
|
||||
DistributedWant& SetUri(const Uri& uri);
|
||||
DistributedWant& SetUri(const OHOS::Uri& uri);
|
||||
|
||||
/**
|
||||
* @description: Sets the description of a URI and a type in this DistributedWant.
|
||||
@ -231,7 +230,7 @@ public:
|
||||
* @param type Indicates the type description.
|
||||
* @return Returns the DistributedWant object containing the URI and the type by setting.
|
||||
*/
|
||||
DistributedWant& SetUriAndType(const Uri& uri, const std::string& type);
|
||||
DistributedWant& SetUriAndType(const OHOS::Uri& uri, const std::string& type);
|
||||
|
||||
/**
|
||||
* @description: Converts a DistributedWant into a URI string containing a representation of it.
|
||||
@ -262,7 +261,7 @@ public:
|
||||
* @param uri Indicates the URI to format.
|
||||
* @return Returns this DistributedWant object that contains the formatted URI attribute.
|
||||
*/
|
||||
DistributedWant& FormatUri(const Uri& uri);
|
||||
DistributedWant& FormatUri(const OHOS::Uri& uri);
|
||||
|
||||
/**
|
||||
* @description: Obtains the description of an action in a DistributedWant.
|
||||
@ -362,7 +361,7 @@ public:
|
||||
* @param type Indicates the MIME type to format.
|
||||
* @return Returns this DistributedWant object that contains the formatted URI and type attributes.
|
||||
*/
|
||||
DistributedWant& FormatUriAndType(const Uri& uri, const std::string& type);
|
||||
DistributedWant& FormatUriAndType(const OHOS::Uri& uri, const std::string& type);
|
||||
|
||||
/**
|
||||
* @description: This method formats data of a specified MIME type
|
||||
@ -433,7 +432,7 @@ public:
|
||||
* @return Returns the byte-type value of the parameter matching the given key;
|
||||
* returns the default value if the key does not exist.
|
||||
*/
|
||||
byte GetByteParam(const std::string& key, byte defaultValue) const;
|
||||
AAFwk::byte GetByteParam(const std::string& key, AAFwk::byte defaultValue) const;
|
||||
|
||||
/**
|
||||
* @description: Obtains a byte-type array matching the given key.
|
||||
@ -441,7 +440,7 @@ public:
|
||||
* @return Returns the byte-type array of the parameter matching the given key;
|
||||
* returns null if the key does not exist.
|
||||
*/
|
||||
std::vector<byte> GetByteArrayParam(const std::string& key) const;
|
||||
std::vector<AAFwk::byte> GetByteArrayParam(const std::string& key) const;
|
||||
|
||||
/**
|
||||
* @description: Sets a parameter value of the byte type.
|
||||
@ -449,7 +448,7 @@ public:
|
||||
* @param value Indicates the byte-type value of the parameter.
|
||||
* @return Returns this DistributedWant object containing the parameter value.
|
||||
*/
|
||||
DistributedWant& SetParam(const std::string& key, byte value);
|
||||
DistributedWant& SetParam(const std::string& key, AAFwk::byte value);
|
||||
|
||||
/**
|
||||
* @description: Sets a parameter value of the byte array type.
|
||||
@ -457,7 +456,7 @@ public:
|
||||
* @param value Indicates the byte array of the parameter.
|
||||
* @return Returns this DistributedWant object containing the parameter value.
|
||||
*/
|
||||
DistributedWant& SetParam(const std::string& key, const std::vector<byte>& value);
|
||||
DistributedWant& SetParam(const std::string& key, const std::vector<AAFwk::byte>& value);
|
||||
|
||||
/**
|
||||
* @description: Obtains a char value matching the given key.
|
||||
@ -466,7 +465,7 @@ public:
|
||||
* @return Returns the char value of the parameter matching the given key;
|
||||
* returns the default value if the key does not exist.
|
||||
*/
|
||||
zchar GetCharParam(const std::string& key, zchar defaultValue) const;
|
||||
AAFwk::zchar GetCharParam(const std::string& key, AAFwk::zchar defaultValue) const;
|
||||
|
||||
/**
|
||||
* @description: Obtains a char array matching the given key.
|
||||
@ -474,7 +473,7 @@ public:
|
||||
* @return Returns the char array of the parameter matching the given key;
|
||||
* returns null if the key does not exist.
|
||||
*/
|
||||
std::vector<zchar> GetCharArrayParam(const std::string& key) const;
|
||||
std::vector<AAFwk::zchar> GetCharArrayParam(const std::string& key) const;
|
||||
|
||||
/**
|
||||
* @description: Sets a parameter value of the char type.
|
||||
@ -482,7 +481,7 @@ public:
|
||||
* @param value Indicates the char value of the parameter.
|
||||
* @return Returns this DistributedWant object containing the parameter value.
|
||||
*/
|
||||
DistributedWant& SetParam(const std::string& key, zchar value);
|
||||
DistributedWant& SetParam(const std::string& key, AAFwk::zchar value);
|
||||
|
||||
/**
|
||||
* @description: Sets a parameter value of the char array type.
|
||||
@ -490,7 +489,7 @@ public:
|
||||
* @param value Indicates the char array of the parameter.
|
||||
* @return Returns this DistributedWant object containing the parameter value.
|
||||
*/
|
||||
DistributedWant& SetParam(const std::string& key, const std::vector<zchar>& value);
|
||||
DistributedWant& SetParam(const std::string& key, const std::vector<AAFwk::zchar>& value);
|
||||
|
||||
/**
|
||||
* @description: Obtains an int value matching the given key.
|
||||
@ -727,7 +726,7 @@ public:
|
||||
* @description: Sets the description of an operation in a DistributedWant.
|
||||
* @param operation Indicates the operation description.
|
||||
*/
|
||||
void SetOperation(const OHOS::AAFwk::DistributedOperation& operation);
|
||||
void SetOperation(const DistributedOperation& operation);
|
||||
|
||||
/**
|
||||
* @description: Sets the description of an operation in a DistributedWant.
|
||||
@ -762,7 +761,7 @@ public:
|
||||
|
||||
static DistributedWant* FromString(std::string& string);
|
||||
|
||||
std::shared_ptr<Want> ToWant();
|
||||
std::shared_ptr<AAFwk::Want> ToWant();
|
||||
|
||||
/**
|
||||
* @description: Sets a device id in a DistributedWant.
|
||||
@ -771,11 +770,8 @@ public:
|
||||
*/
|
||||
DistributedWant& SetDeviceId(const std::string& deviceId);
|
||||
public:
|
||||
// action definition
|
||||
static const std::string ACTION_PLAY;
|
||||
static const std::string ACTION_HOME;
|
||||
|
||||
// entity definition
|
||||
static const std::string ENTITY_HOME;
|
||||
static const std::string ENTITY_VIDEO;
|
||||
static const std::string FLAG_HOME_INTENT_FROM_SYSTEM;
|
||||
@ -788,15 +784,10 @@ public:
|
||||
static const std::string ENTITY_MESSAGING;
|
||||
static const std::string ENTITY_FILES;
|
||||
static const std::string ENTITY_GALLERY;
|
||||
|
||||
// flag definition
|
||||
static unsigned int FLAG_ABILITY_NEW_MISSION;
|
||||
static unsigned int FLAG_ABILITY_CLEAR_MISSION;
|
||||
|
||||
static constexpr int HEX_STRING_BUF_LEN = 36;
|
||||
static constexpr int HEX_STRING_LEN = 10;
|
||||
|
||||
// reserved param definition
|
||||
static const std::string PARAM_RESV_WINDOW_MODE;
|
||||
static const std::string PARAM_RESV_DISPLAY_ID;
|
||||
static const std::string PARAM_RESV_CALLER_TOKEN;
|
||||
@ -812,9 +803,7 @@ private:
|
||||
static const std::string MIME_TYPE;
|
||||
static const std::string WANT_HEADER;
|
||||
|
||||
// no object in parcel
|
||||
static constexpr int VALUE_NULL = -1;
|
||||
// object exist in parcel
|
||||
static constexpr int VALUE_OBJECT = 1;
|
||||
|
||||
private:
|
||||
@ -825,13 +814,12 @@ private:
|
||||
static bool ParseUriInternal(const std::string& content, OHOS::AppExecFwk::ElementName& element, DistributedWant& want);
|
||||
bool ReadFromParcel(Parcel& parcel);
|
||||
static bool CheckAndSetParameters(DistributedWant& want, const std::string& key, std::string& prop, const std::string& value);
|
||||
Uri GetLowerCaseScheme(const Uri& uri);
|
||||
OHOS::Uri GetLowerCaseScheme(const OHOS::Uri& uri);
|
||||
void ToUriStringInner(std::string& uriString) const;
|
||||
nlohmann::json ToJson() const;
|
||||
bool ReadFromJson(nlohmann::json& wantJson);
|
||||
void SetParameters(std::shared_ptr<Want>& want, DistributedWantParams& params);
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OHOS_AAFWK_DISTRIBUTED_WANT_H
|
||||
#endif // OHOS_DISTRIBUTEDWANT_WANT_H
|
||||
|
@ -12,8 +12,8 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef OHOS_AAFWK_DISTRIBUTED_WANT_PARAMS_H
|
||||
#define OHOS_AAFWK_DISTRIBUTED_WANT_PARAMS_H
|
||||
#ifndef OHOS_DISTRIBUTEDWANT_WANT_PARAMS_H
|
||||
#define OHOS_DISTRIBUTEDWANT_WANT_PARAMS_H
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
@ -25,7 +25,7 @@
|
||||
#include "want_params.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace DistributedSchedule {
|
||||
class DistributedUnsupportedData {
|
||||
public:
|
||||
std::u16string key;
|
||||
@ -53,19 +53,19 @@ public:
|
||||
|
||||
bool operator==(const DistributedWantParams& other);
|
||||
|
||||
static sptr<IInterface> GetInterfaceByType(int typeId, const std::string& value);
|
||||
static sptr<AAFwk::IInterface> GetInterfaceByType(int typeId, const std::string& value);
|
||||
|
||||
static bool CompareInterface(const sptr<IInterface> iIt1, const sptr<IInterface> iIt2, int typeId);
|
||||
static bool CompareInterface(const sptr<AAFwk::IInterface> iIt1, const sptr<AAFwk::IInterface> iIt2, int typeId);
|
||||
|
||||
static int GetDataType(const sptr<IInterface> iIt);
|
||||
static int GetDataType(const sptr<AAFwk::IInterface> iIt);
|
||||
|
||||
static std::string GetStringByType(const sptr<IInterface> iIt, int typeId);
|
||||
static std::string GetStringByType(const sptr<AAFwk::IInterface> iIt, int typeId);
|
||||
|
||||
void SetParam(const std::string& key, IInterface* value);
|
||||
void SetParam(const std::string& key, AAFwk::IInterface* value);
|
||||
|
||||
sptr<IInterface> GetParam(const std::string& key) const;
|
||||
sptr<AAFwk::IInterface> GetParam(const std::string& key) const;
|
||||
|
||||
const std::map<std::string, sptr<IInterface>>& GetParams() const;
|
||||
const std::map<std::string, sptr<AAFwk::IInterface>>& GetParams() const;
|
||||
|
||||
const std::set<std::string> KeySet() const;
|
||||
|
||||
@ -81,7 +81,7 @@ public:
|
||||
|
||||
static DistributedWantParams* Unmarshalling(Parcel& parcel);
|
||||
|
||||
WantParams ToWantParams();
|
||||
AAFwk::WantParams ToWantParams();
|
||||
|
||||
private:
|
||||
enum {
|
||||
@ -116,8 +116,8 @@ private:
|
||||
VALUE_TYPE_ARRAY = 102,
|
||||
};
|
||||
|
||||
bool WriteArrayToParcel(Parcel& parcel, IArray* ao) const;
|
||||
bool ReadArrayToParcel(Parcel& parcel, int type, sptr<IArray>& ao);
|
||||
bool WriteArrayToParcel(Parcel& parcel, AAFwk::IArray* ao) const;
|
||||
bool ReadArrayToParcel(Parcel& parcel, int type, sptr<AAFwk::IArray>& ao);
|
||||
bool ReadFromParcel(Parcel& parcel);
|
||||
bool ReadFromParcelParam(Parcel& parcel, const std::string& key, int type);
|
||||
bool ReadFromParcelString(Parcel& parcel, const std::string& key);
|
||||
@ -130,39 +130,39 @@ private:
|
||||
bool ReadFromParcelFloat(Parcel& parcel, const std::string& key);
|
||||
bool ReadFromParcelDouble(Parcel& parcel, const std::string& key);
|
||||
|
||||
bool ReadFromParcelArrayString(Parcel& parcel, sptr<IArray>& ao);
|
||||
bool ReadFromParcelArrayBool(Parcel& parcel, sptr<IArray>& ao);
|
||||
bool ReadFromParcelArrayByte(Parcel& parcel, sptr<IArray>& ao);
|
||||
bool ReadFromParcelArrayChar(Parcel& parcel, sptr<IArray>& ao);
|
||||
bool ReadFromParcelArrayShort(Parcel& parcel, sptr<IArray>& ao);
|
||||
bool ReadFromParcelArrayString(Parcel& parcel, sptr<AAFwk::IArray>& ao);
|
||||
bool ReadFromParcelArrayBool(Parcel& parcel, sptr<AAFwk::IArray>& ao);
|
||||
bool ReadFromParcelArrayByte(Parcel& parcel, sptr<AAFwk::IArray>& ao);
|
||||
bool ReadFromParcelArrayChar(Parcel& parcel, sptr<AAFwk::IArray>& ao);
|
||||
bool ReadFromParcelArrayShort(Parcel& parcel, sptr<AAFwk::IArray>& ao);
|
||||
|
||||
bool ReadFromParcelArrayInt(Parcel& parcel, sptr<IArray>& ao);
|
||||
bool ReadFromParcelArrayLong(Parcel& parcel, sptr<IArray>& ao);
|
||||
bool ReadFromParcelArrayFloat(Parcel& parcel, sptr<IArray>& ao);
|
||||
bool ReadFromParcelArrayDouble(Parcel& parcel, sptr<IArray>& ao);
|
||||
bool ReadFromParcelArrayInt(Parcel& parcel, sptr<AAFwk::IArray>& ao);
|
||||
bool ReadFromParcelArrayLong(Parcel& parcel, sptr<AAFwk::IArray>& ao);
|
||||
bool ReadFromParcelArrayFloat(Parcel& parcel, sptr<AAFwk::IArray>& ao);
|
||||
bool ReadFromParcelArrayDouble(Parcel& parcel, sptr<AAFwk::IArray>& ao);
|
||||
bool ReadFromParcelWantParamWrapper(Parcel& parcel, const std::string& key);
|
||||
|
||||
bool WriteArrayToParcelString(Parcel& parcel, IArray* ao) const;
|
||||
bool WriteArrayToParcelBool(Parcel& parcel, IArray* ao) const;
|
||||
bool WriteArrayToParcelByte(Parcel& parcel, IArray* ao) const;
|
||||
bool WriteArrayToParcelChar(Parcel& parcel, IArray* ao) const;
|
||||
bool WriteArrayToParcelShort(Parcel& parcel, IArray* ao) const;
|
||||
bool WriteArrayToParcelInt(Parcel& parcel, IArray* ao) const;
|
||||
bool WriteArrayToParcelLong(Parcel& parcel, IArray* ao) const;
|
||||
bool WriteArrayToParcelFloat(Parcel& parcel, IArray* ao) const;
|
||||
bool WriteArrayToParcelDouble(Parcel& parcel, IArray* ao) const;
|
||||
bool WriteArrayToParcelString(Parcel& parcel, AAFwk::IArray* ao) const;
|
||||
bool WriteArrayToParcelBool(Parcel& parcel, AAFwk::IArray* ao) const;
|
||||
bool WriteArrayToParcelByte(Parcel& parcel, AAFwk::IArray* ao) const;
|
||||
bool WriteArrayToParcelChar(Parcel& parcel, AAFwk::IArray* ao) const;
|
||||
bool WriteArrayToParcelShort(Parcel& parcel, AAFwk::IArray* ao) const;
|
||||
bool WriteArrayToParcelInt(Parcel& parcel, AAFwk::IArray* ao) const;
|
||||
bool WriteArrayToParcelLong(Parcel& parcel, AAFwk::IArray* ao) const;
|
||||
bool WriteArrayToParcelFloat(Parcel& parcel, AAFwk::IArray* ao) const;
|
||||
bool WriteArrayToParcelDouble(Parcel& parcel, AAFwk::IArray* ao) const;
|
||||
|
||||
bool WriteMarshalling(Parcel& parcel, sptr<IInterface>& o) const;
|
||||
bool WriteToParcelString(Parcel& parcel, sptr<IInterface>& o) const;
|
||||
bool WriteToParcelBool(Parcel& parcel, sptr<IInterface>& o) const;
|
||||
bool WriteToParcelByte(Parcel& parcel, sptr<IInterface>& o) const;
|
||||
bool WriteToParcelChar(Parcel& parcel, sptr<IInterface>& o) const;
|
||||
bool WriteToParcelShort(Parcel& parcel, sptr<IInterface>& o) const;
|
||||
bool WriteToParcelInt(Parcel& parcel, sptr<IInterface>& o) const;
|
||||
bool WriteToParcelLong(Parcel& parcel, sptr<IInterface>& o) const;
|
||||
bool WriteToParcelFloat(Parcel& parcel, sptr<IInterface>& o) const;
|
||||
bool WriteToParcelDouble(Parcel& parcel, sptr<IInterface>& o) const;
|
||||
bool WriteToParcelWantParams(Parcel& parcel, sptr<IInterface>& o) const;
|
||||
bool WriteMarshalling(Parcel& parcel, sptr<AAFwk::IInterface>& o) const;
|
||||
bool WriteToParcelString(Parcel& parcel, sptr<AAFwk::IInterface>& o) const;
|
||||
bool WriteToParcelBool(Parcel& parcel, sptr<AAFwk::IInterface>& o) const;
|
||||
bool WriteToParcelByte(Parcel& parcel, sptr<AAFwk::IInterface>& o) const;
|
||||
bool WriteToParcelChar(Parcel& parcel, sptr<AAFwk::IInterface>& o) const;
|
||||
bool WriteToParcelShort(Parcel& parcel, sptr<AAFwk::IInterface>& o) const;
|
||||
bool WriteToParcelInt(Parcel& parcel, sptr<AAFwk::IInterface>& o) const;
|
||||
bool WriteToParcelLong(Parcel& parcel, sptr<AAFwk::IInterface>& o) const;
|
||||
bool WriteToParcelFloat(Parcel& parcel, sptr<AAFwk::IInterface>& o) const;
|
||||
bool WriteToParcelDouble(Parcel& parcel, sptr<AAFwk::IInterface>& o) const;
|
||||
bool WriteToParcelWantParams(Parcel& parcel, sptr<AAFwk::IInterface>& o) const;
|
||||
|
||||
bool DoMarshalling(Parcel& parcel) const;
|
||||
bool ReadUnsupportedData(Parcel& parcel, const std::string& key, int type);
|
||||
@ -170,12 +170,12 @@ private:
|
||||
friend class DistributedWantParamWrapper;
|
||||
friend class DistributedWant;
|
||||
// inner use function
|
||||
bool NewArrayData(IArray* source, sptr<IArray>& dest);
|
||||
bool NewArrayData(AAFwk::IArray* source, sptr<AAFwk::IArray>& dest);
|
||||
bool NewParams(const DistributedWantParams& source, DistributedWantParams& dest);
|
||||
std::map<std::string, sptr<IInterface>> params_;
|
||||
std::map<std::string, sptr<AAFwk::IInterface>> params_;
|
||||
std::vector<DistributedUnsupportedData> cachedUnsupportedData_;
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
||||
#endif // OHOS_AAFWK_DISTRIBUTED_WANT_PARAMS_H
|
||||
#endif // OHOS_DISTRIBUTEDWANT_WANT_PARAMS_H
|
@ -12,19 +12,21 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef OHOS_ABILITY_BASE_DISTRIBUTED_WANT_PARAMS_WRAPPER_H
|
||||
#define OHOS_ABILITY_BASE_DISTRIBUTED_WANT_PARAMS_WRAPPER_H
|
||||
#ifndef OHOS_DISTRIBUTEDWANT_WANT_PARAMS_WRAPPER_H
|
||||
#define OHOS_DISTRIBUTEDWANT_WANT_PARAMS_WRAPPER_H
|
||||
|
||||
#include "base_def.h"
|
||||
#include "base_object.h"
|
||||
#include "distributed_want_params.h"
|
||||
|
||||
using InterfaceID = OHOS::AAFwk::InterfaceID;
|
||||
using IInterface = OHOS::AAFwk::IInterface;
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace DistributedSchedule {
|
||||
class DistributedWantParams;
|
||||
INTERFACE(IDistributedWantParams, a75b9db6 - 9813 - 4371 - 8848 - d2966ce6ec68)
|
||||
{
|
||||
inline static IDistributedWantParams* Query(IInterface* object)
|
||||
inline static IDistributedWantParams* Query(AAFwk::IInterface* object)
|
||||
{
|
||||
if (object == nullptr) {
|
||||
return nullptr;
|
||||
@ -34,7 +36,7 @@ INTERFACE(IDistributedWantParams, a75b9db6 - 9813 - 4371 - 8848 - d2966ce6ec68)
|
||||
|
||||
virtual ErrCode GetValue(DistributedWantParams& value) = 0;
|
||||
};
|
||||
class DistributedWantParamWrapper final : public Object, public IDistributedWantParams {
|
||||
class DistributedWantParamWrapper final : public AAFwk::Object, public IDistributedWantParams {
|
||||
public:
|
||||
inline DistributedWantParamWrapper(const DistributedWantParams& value) : wantParams_(value)
|
||||
{}
|
||||
@ -77,6 +79,6 @@ public:
|
||||
private:
|
||||
DistributedWantParams wantParams_;
|
||||
};
|
||||
} // namespace AAFwk
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
#endif // OHOS_ABILITY_BASE_DISTRIBUTED_WANT_PARAMS_WRAPPER_H
|
||||
#endif // OHOS_DISTRIBUTEDWANT_WANT_PARAMS_WRAPPER_H
|
@ -13,13 +13,12 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "distributedWant/distributed_operation.h"
|
||||
#include "distributedWant/distributed_operation_builder.h"
|
||||
#include "distributed_operation.h"
|
||||
#include "distributed_operation_builder.h"
|
||||
#include "parcel_macro_base.h"
|
||||
|
||||
using namespace OHOS::AppExecFwk;
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace DistributedSchedule {
|
||||
DistributedOperation::DistributedOperation() : flags_(0), uri_("")
|
||||
{
|
||||
}
|
||||
@ -384,5 +383,5 @@ void DistributedOperation::SetModuleName(const std::string& moduleName)
|
||||
{
|
||||
moduleName_ = moduleName;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
@ -13,11 +13,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "distributedWant/distributed_operation.h"
|
||||
#include "distributedWant/distributed_operation_builder.h"
|
||||
#include "distributed_operation.h"
|
||||
#include "distributed_operation_builder.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace DistributedSchedule {
|
||||
DistributedOperationBuilder::DistributedOperationBuilder()
|
||||
: abilityName_(""), action_(""), bundleName_(""), deviceId_(""), flags_(0), uri_("")
|
||||
{
|
||||
@ -110,5 +110,5 @@ std::shared_ptr<DistributedOperation> DistributedOperationBuilder::build()
|
||||
|
||||
return operation;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
@ -18,14 +18,13 @@
|
||||
#include <cstdlib>
|
||||
#include <regex>
|
||||
#include <securec.h>
|
||||
|
||||
#include "array_wrapper.h"
|
||||
#include "base_object.h"
|
||||
#include "bool_wrapper.h"
|
||||
#include "byte_wrapper.h"
|
||||
#include "distributedWant/distributed_operation_builder.h"
|
||||
#include "distributedWant/distributed_want.h"
|
||||
#include "distributedWant/distributed_want_params_wrapper.h"
|
||||
#include "distributed_operation_builder.h"
|
||||
#include "distributed_want.h"
|
||||
#include "distributed_want_params_wrapper.h"
|
||||
#include "double_wrapper.h"
|
||||
#include "float_wrapper.h"
|
||||
#include "int_wrapper.h"
|
||||
@ -40,7 +39,7 @@ using namespace OHOS::AppExecFwk;
|
||||
using OHOS::AppExecFwk::ElementName;
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace DistributedSchedule {
|
||||
namespace {
|
||||
const std::regex NUMBER_REGEX("^[-+]?([0-9]+)([.]([0-9]+))?$");
|
||||
}; // namespace
|
||||
@ -105,7 +104,7 @@ DistributedWant&DistributedWant::operator=(const DistributedWant& other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
DistributedWant::DistributedWant(const Want& want)
|
||||
DistributedWant::DistributedWant(const AAFwk::Want& want)
|
||||
{
|
||||
DistributedOperationBuilder builder;
|
||||
builder.WithAbilityName(want.GetElement().GetAbilityName());
|
||||
@ -117,9 +116,9 @@ DistributedWant::DistributedWant(const Want& want)
|
||||
builder.WithUri(want.GetUri());
|
||||
std::shared_ptr<DistributedOperation> op = builder.build();
|
||||
operation_ = *op;
|
||||
std::map<std::string, sptr<IInterface>> data = want.GetParams().GetParams();
|
||||
std::map<std::string, sptr<AAFwk::IInterface>> data = want.GetParams().GetParams();
|
||||
for (auto it = data.begin(); it != data.end(); it++) {
|
||||
auto tp = WantParams::GetDataType(it->second);
|
||||
auto tp = AAFwk::WantParams::GetDataType(it->second);
|
||||
if ((tp == DistributedWantParams::VALUE_TYPE_BOOLEAN) ||
|
||||
(tp == DistributedWantParams::VALUE_TYPE_BYTE) ||
|
||||
(tp == DistributedWantParams::VALUE_TYPE_CHAR) ||
|
||||
@ -136,8 +135,8 @@ DistributedWant::DistributedWant(const Want& want)
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Want> DistributedWant::ToWant() {
|
||||
auto want = std::make_shared<Want>();
|
||||
std::shared_ptr<AAFwk::Want> DistributedWant::ToWant() {
|
||||
auto want = std::make_shared<AAFwk::Want>();
|
||||
want->SetFlags(GetFlags());
|
||||
want->SetElement(GetElement());
|
||||
want->SetUri(GetUri());
|
||||
@ -323,9 +322,9 @@ DistributedWant& DistributedWant::SetBundle(const std::string& bundleName)
|
||||
std::string DistributedWant::GetType() const
|
||||
{
|
||||
auto value = parameters_.GetParam(MIME_TYPE);
|
||||
IString* ao = IString::Query(value);
|
||||
AAFwk::IString* ao = AAFwk::IString::Query(value);
|
||||
if (ao != nullptr) {
|
||||
return String::Unbox(ao);
|
||||
return AAFwk::String::Unbox(ao);
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
@ -337,7 +336,7 @@ std::string DistributedWant::GetType() const
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetType(const std::string& type)
|
||||
{
|
||||
sptr<IString> valueObj = String::Parse(type);
|
||||
sptr<AAFwk::IString> valueObj = AAFwk::String::Parse(type);
|
||||
parameters_.SetParam(MIME_TYPE, valueObj);
|
||||
return *this;
|
||||
}
|
||||
@ -503,9 +502,9 @@ DistributedWant& DistributedWant::SetParams(const DistributedWantParams& wantPar
|
||||
bool DistributedWant::GetBoolParam(const std::string& key, bool defaultValue) const
|
||||
{
|
||||
auto value = parameters_.GetParam(key);
|
||||
IBoolean* bo = IBoolean::Query(value);
|
||||
AAFwk::IBoolean* bo = AAFwk::IBoolean::Query(value);
|
||||
if (bo != nullptr) {
|
||||
return Boolean::Unbox(bo);
|
||||
return AAFwk::Boolean::Unbox(bo);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
@ -520,18 +519,17 @@ std::vector<bool> DistributedWant::GetBoolArrayParam(const std::string& key) con
|
||||
{
|
||||
std::vector<bool> array;
|
||||
auto value = parameters_.GetParam(key);
|
||||
IArray* ao = IArray::Query(value);
|
||||
if (ao != nullptr && Array::IsBooleanArray(ao)) {
|
||||
auto func = [&](IInterface* object) {
|
||||
AAFwk::IArray* ao = AAFwk::IArray::Query(value);
|
||||
if (ao != nullptr && AAFwk::Array::IsBooleanArray(ao)) {
|
||||
auto func = [&](AAFwk::IInterface* object) {
|
||||
if (object != nullptr) {
|
||||
IBoolean* value = IBoolean::Query(object);
|
||||
AAFwk::IBoolean* value = AAFwk::IBoolean::Query(object);
|
||||
if (value != nullptr) {
|
||||
array.push_back(Boolean::Unbox(value));
|
||||
array.push_back(AAFwk::Boolean::Unbox(value));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Array::ForEach(ao, func);
|
||||
AAFwk::Array::ForEach(ao, func);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
@ -544,7 +542,7 @@ std::vector<bool> DistributedWant::GetBoolArrayParam(const std::string& key) con
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetParam(const std::string&key, bool value)
|
||||
{
|
||||
parameters_.SetParam(key, Boolean::Box(value));
|
||||
parameters_.SetParam(key, AAFwk::Boolean::Box(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -557,10 +555,10 @@ DistributedWant& DistributedWant::SetParam(const std::string&key, bool value)
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<bool>& value)
|
||||
{
|
||||
std::size_t size = value.size();
|
||||
sptr<IArray> ao = new (std::nothrow) Array(size, g_IID_IBoolean);
|
||||
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IBoolean);
|
||||
if (ao != nullptr) {
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
ao->Set(i, Boolean::Box(value[i]));
|
||||
ao->Set(i, AAFwk::Boolean::Box(value[i]));
|
||||
}
|
||||
parameters_.SetParam(key, ao);
|
||||
}
|
||||
@ -574,12 +572,12 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, const std::ve
|
||||
* @return Returns the byte-type value of the parameter matching the given key;
|
||||
* returns the default value if the key does not exist.
|
||||
*/
|
||||
byte DistributedWant::GetByteParam(const std::string& key, const byte defaultValue) const
|
||||
AAFwk::byte DistributedWant::GetByteParam(const std::string& key, const AAFwk::byte defaultValue) const
|
||||
{
|
||||
auto value = parameters_.GetParam(key);
|
||||
IByte* bo = IByte::Query(value);
|
||||
AAFwk::IByte* bo = AAFwk::IByte::Query(value);
|
||||
if (bo != nullptr) {
|
||||
return Byte::Unbox(bo);
|
||||
return AAFwk::Byte::Unbox(bo);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
@ -590,21 +588,21 @@ byte DistributedWant::GetByteParam(const std::string& key, const byte defaultVal
|
||||
* @return Returns the byte-type array of the parameter matching the given key;
|
||||
* returns null if the key does not exist.
|
||||
*/
|
||||
std::vector<byte> DistributedWant::GetByteArrayParam(const std::string& key) const
|
||||
std::vector<AAFwk::byte> DistributedWant::GetByteArrayParam(const std::string& key) const
|
||||
{
|
||||
std::vector<byte> array;
|
||||
std::vector<AAFwk::byte> array;
|
||||
auto value = parameters_.GetParam(key);
|
||||
IArray* ao = IArray::Query(value);
|
||||
if (ao != nullptr && Array::IsByteArray(ao)) {
|
||||
auto func = [&](IInterface* object) {
|
||||
AAFwk::IArray* ao = AAFwk::IArray::Query(value);
|
||||
if (ao != nullptr && AAFwk::Array::IsByteArray(ao)) {
|
||||
auto func = [&](AAFwk::IInterface* object) {
|
||||
if (object != nullptr) {
|
||||
IByte* value = IByte::Query(object);
|
||||
AAFwk::IByte* value = AAFwk::IByte::Query(object);
|
||||
if (value != nullptr) {
|
||||
array.push_back(Byte::Unbox(value));
|
||||
array.push_back(AAFwk::Byte::Unbox(value));
|
||||
}
|
||||
}
|
||||
};
|
||||
Array::ForEach(ao, func);
|
||||
AAFwk::Array::ForEach(ao, func);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
@ -615,9 +613,9 @@ std::vector<byte> DistributedWant::GetByteArrayParam(const std::string& key) con
|
||||
* @param value Indicates the byte-type value of the parameter.
|
||||
* @return Returns this object containing the parameter value.
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, byte value)
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, AAFwk::byte value)
|
||||
{
|
||||
parameters_.SetParam(key, Byte::Box(value));
|
||||
parameters_.SetParam(key, AAFwk::Byte::Box(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -627,15 +625,15 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, byte value)
|
||||
* @param value Indicates the byte array of the parameter.
|
||||
* @return Returns this object containing the parameter value.
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<byte>& value)
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<AAFwk::byte>& value)
|
||||
{
|
||||
std::size_t size = value.size();
|
||||
sptr<IArray> ao = new (std::nothrow) Array(size, g_IID_IByte);
|
||||
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IByte);
|
||||
if (ao == nullptr) {
|
||||
return *this;
|
||||
}
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
ao->Set(i, Byte::Box(value[i]));
|
||||
ao->Set(i, AAFwk::Byte::Box(value[i]));
|
||||
}
|
||||
parameters_.SetParam(key, ao);
|
||||
return *this;
|
||||
@ -648,12 +646,12 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, const std::ve
|
||||
* @return Returns the char value of the parameter matching the given key;
|
||||
* returns the default value if the key does not exist.
|
||||
*/
|
||||
zchar DistributedWant::GetCharParam(const std::string& key, zchar defaultValue) const
|
||||
AAFwk::zchar DistributedWant::GetCharParam(const std::string& key, AAFwk::zchar defaultValue) const
|
||||
{
|
||||
auto value = parameters_.GetParam(key);
|
||||
IChar* ao = IChar::Query(value);
|
||||
AAFwk::IChar* ao = AAFwk::IChar::Query(value);
|
||||
if (ao != nullptr) {
|
||||
return Char::Unbox(ao);
|
||||
return AAFwk::Char::Unbox(ao);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
@ -664,21 +662,21 @@ zchar DistributedWant::GetCharParam(const std::string& key, zchar defaultValue)
|
||||
* @return Returns the char array of the parameter matching the given key;
|
||||
* returns null if the key does not exist.
|
||||
*/
|
||||
std::vector<zchar> DistributedWant::GetCharArrayParam(const std::string& key) const
|
||||
std::vector<AAFwk::zchar> DistributedWant::GetCharArrayParam(const std::string& key) const
|
||||
{
|
||||
std::vector<zchar> array;
|
||||
std::vector<AAFwk::zchar> array;
|
||||
auto value = parameters_.GetParam(key);
|
||||
IArray* ao = IArray::Query(value);
|
||||
if (ao != nullptr && Array::IsCharArray(ao)) {
|
||||
auto func = [&](IInterface* object) {
|
||||
AAFwk::IArray* ao = AAFwk::IArray::Query(value);
|
||||
if (ao != nullptr && AAFwk::Array::IsCharArray(ao)) {
|
||||
auto func = [&](AAFwk::IInterface* object) {
|
||||
if (object != nullptr) {
|
||||
IChar* value = IChar::Query(object);
|
||||
AAFwk::IChar* value = AAFwk::IChar::Query(object);
|
||||
if (value != nullptr) {
|
||||
array.push_back(Char::Unbox(value));
|
||||
array.push_back(AAFwk::Char::Unbox(value));
|
||||
}
|
||||
}
|
||||
};
|
||||
Array::ForEach(ao, func);
|
||||
AAFwk::Array::ForEach(ao, func);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
@ -689,9 +687,9 @@ std::vector<zchar> DistributedWant::GetCharArrayParam(const std::string& key) co
|
||||
* @param value Indicates the char value of the parameter.
|
||||
* @return Returns this DistributedWant object containing the parameter value.
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, zchar value)
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, AAFwk::zchar value)
|
||||
{
|
||||
parameters_.SetParam(key, Char::Box(value));
|
||||
parameters_.SetParam(key, AAFwk::Char::Box(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -701,15 +699,15 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, zchar value)
|
||||
* @param value Indicates the char array of the parameter.
|
||||
* @return Returns this DistributedWant object containing the parameter value.
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<zchar>& value)
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<AAFwk::zchar>& value)
|
||||
{
|
||||
std::size_t size = value.size();
|
||||
sptr<IArray> ao = new (std::nothrow) Array(size, g_IID_IChar);
|
||||
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IChar);
|
||||
if (ao == nullptr) {
|
||||
return *this;
|
||||
}
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
ao->Set(i, Char::Box(value[i]));
|
||||
ao->Set(i, AAFwk::Char::Box(value[i]));
|
||||
}
|
||||
parameters_.SetParam(key, ao);
|
||||
return *this;
|
||||
@ -725,9 +723,9 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, const std::ve
|
||||
int DistributedWant::GetIntParam(const std::string& key, const int defaultValue) const
|
||||
{
|
||||
auto value = parameters_.GetParam(key);
|
||||
IInteger* ao = IInteger::Query(value);
|
||||
AAFwk::IInteger* ao = AAFwk::IInteger::Query(value);
|
||||
if (ao != nullptr) {
|
||||
return Integer::Unbox(ao);
|
||||
return AAFwk::Integer::Unbox(ao);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
@ -742,17 +740,17 @@ std::vector<int> DistributedWant::GetIntArrayParam(const std::string& key) const
|
||||
{
|
||||
std::vector<int> array;
|
||||
auto value = parameters_.GetParam(key);
|
||||
IArray* ao = IArray::Query(value);
|
||||
if (ao != nullptr && Array::IsIntegerArray(ao)) {
|
||||
auto func = [&](IInterface* object) {
|
||||
AAFwk::IArray* ao = AAFwk::IArray::Query(value);
|
||||
if (ao != nullptr && AAFwk::Array::IsIntegerArray(ao)) {
|
||||
auto func = [&](AAFwk::IInterface* object) {
|
||||
if (object != nullptr) {
|
||||
IInteger* value = IInteger::Query(object);
|
||||
AAFwk::IInteger* value = AAFwk::IInteger::Query(object);
|
||||
if (value != nullptr) {
|
||||
array.push_back(Integer::Unbox(value));
|
||||
array.push_back(AAFwk::Integer::Unbox(value));
|
||||
}
|
||||
}
|
||||
};
|
||||
Array::ForEach(ao, func);
|
||||
AAFwk::Array::ForEach(ao, func);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
@ -765,7 +763,7 @@ std::vector<int> DistributedWant::GetIntArrayParam(const std::string& key) const
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, int value)
|
||||
{
|
||||
parameters_.SetParam(key, Integer::Box(value));
|
||||
parameters_.SetParam(key, AAFwk::Integer::Box(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -778,12 +776,12 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, int value)
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<int>& value)
|
||||
{
|
||||
std::size_t size = value.size();
|
||||
sptr<IArray> ao = new (std::nothrow) Array(size, g_IID_IInteger);
|
||||
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IInteger);
|
||||
if (ao == nullptr) {
|
||||
return *this;
|
||||
}
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
ao->Set(i, Integer::Box(value[i]));
|
||||
ao->Set(i, AAFwk::Integer::Box(value[i]));
|
||||
}
|
||||
parameters_.SetParam(key, ao);
|
||||
return *this;
|
||||
@ -799,9 +797,9 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, const std::ve
|
||||
double DistributedWant::GetDoubleParam(const std::string& key, double defaultValue) const
|
||||
{
|
||||
auto value = parameters_.GetParam(key);
|
||||
IDouble* ao = IDouble::Query(value);
|
||||
AAFwk::IDouble* ao = AAFwk::IDouble::Query(value);
|
||||
if (ao != nullptr) {
|
||||
return Double::Unbox(ao);
|
||||
return AAFwk::Double::Unbox(ao);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
@ -816,17 +814,17 @@ std::vector<double> DistributedWant::GetDoubleArrayParam(const std::string& key)
|
||||
{
|
||||
std::vector<double> array;
|
||||
auto value = parameters_.GetParam(key);
|
||||
IArray* ao = IArray::Query(value);
|
||||
if (ao != nullptr && Array::IsDoubleArray(ao)) {
|
||||
auto func = [&](IInterface* object) {
|
||||
AAFwk::IArray* ao = AAFwk::IArray::Query(value);
|
||||
if (ao != nullptr && AAFwk::Array::IsDoubleArray(ao)) {
|
||||
auto func = [&](AAFwk::IInterface* object) {
|
||||
if (object != nullptr) {
|
||||
IDouble* value = IDouble::Query(object);
|
||||
AAFwk::IDouble* value = AAFwk::IDouble::Query(object);
|
||||
if (value != nullptr) {
|
||||
array.push_back(Double::Unbox(value));
|
||||
array.push_back(AAFwk::Double::Unbox(value));
|
||||
}
|
||||
}
|
||||
};
|
||||
Array::ForEach(ao, func);
|
||||
AAFwk::Array::ForEach(ao, func);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
@ -839,7 +837,7 @@ std::vector<double> DistributedWant::GetDoubleArrayParam(const std::string& key)
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, double value)
|
||||
{
|
||||
parameters_.SetParam(key, Double::Box(value));
|
||||
parameters_.SetParam(key, AAFwk::Double::Box(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -852,12 +850,12 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, double value)
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<double>& value)
|
||||
{
|
||||
std::size_t size = value.size();
|
||||
sptr<IArray> ao = new (std::nothrow) Array(size, g_IID_IDouble);
|
||||
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IDouble);
|
||||
if (ao == nullptr) {
|
||||
return *this;
|
||||
}
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
ao->Set(i, Double::Box(value[i]));
|
||||
ao->Set(i, AAFwk::Double::Box(value[i]));
|
||||
}
|
||||
parameters_.SetParam(key, ao);
|
||||
return *this;
|
||||
@ -873,9 +871,9 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, const std::ve
|
||||
float DistributedWant::GetFloatParam(const std::string& key, float defaultValue) const
|
||||
{
|
||||
auto value = parameters_.GetParam(key);
|
||||
IFloat* ao = IFloat::Query(value);
|
||||
AAFwk::IFloat* ao = AAFwk::IFloat::Query(value);
|
||||
if (ao != nullptr) {
|
||||
return Float::Unbox(ao);
|
||||
return AAFwk::Float::Unbox(ao);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
@ -889,17 +887,17 @@ std::vector<float> DistributedWant::GetFloatArrayParam(const std::string& key) c
|
||||
{
|
||||
std::vector<float> array;
|
||||
auto value = parameters_.GetParam(key);
|
||||
IArray* ao = IArray::Query(value);
|
||||
if (ao != nullptr && Array::IsFloatArray(ao)) {
|
||||
auto func = [&](IInterface* object) {
|
||||
AAFwk::IArray* ao = AAFwk::IArray::Query(value);
|
||||
if (ao != nullptr && AAFwk::Array::IsFloatArray(ao)) {
|
||||
auto func = [&](AAFwk::IInterface* object) {
|
||||
if (object != nullptr) {
|
||||
IFloat* value = IFloat::Query(object);
|
||||
AAFwk::IFloat* value = AAFwk::IFloat::Query(object);
|
||||
if (value != nullptr) {
|
||||
array.push_back(Float::Unbox(value));
|
||||
array.push_back(AAFwk::Float::Unbox(value));
|
||||
}
|
||||
}
|
||||
};
|
||||
Array::ForEach(ao, func);
|
||||
AAFwk::Array::ForEach(ao, func);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
@ -912,7 +910,7 @@ std::vector<float> DistributedWant::GetFloatArrayParam(const std::string& key) c
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, float value)
|
||||
{
|
||||
parameters_.SetParam(key, Float::Box(value));
|
||||
parameters_.SetParam(key, AAFwk::Float::Box(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -925,13 +923,13 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, float value)
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<float>& value)
|
||||
{
|
||||
std::size_t size = value.size();
|
||||
sptr<IArray> ao = new (std::nothrow) Array(size, g_IID_IFloat);
|
||||
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IFloat);
|
||||
if (ao == nullptr) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
ao->Set(i, Float::Box(value[i]));
|
||||
ao->Set(i, AAFwk::Float::Box(value[i]));
|
||||
}
|
||||
parameters_.SetParam(key, ao);
|
||||
return *this;
|
||||
@ -948,11 +946,11 @@ long DistributedWant::GetLongParam(const std::string& key, long defaultValue) co
|
||||
{
|
||||
auto value = parameters_.GetParam(key);
|
||||
|
||||
if (ILong::Query(value) != nullptr) {
|
||||
return Long::Unbox(ILong::Query(value));
|
||||
} else if (IString::Query(value) != nullptr) {
|
||||
if (AAFwk::ILong::Query(value) != nullptr) {
|
||||
return AAFwk::Long::Unbox(AAFwk::ILong::Query(value));
|
||||
} else if (AAFwk::IString::Query(value) != nullptr) {
|
||||
// Marshalling
|
||||
std::string str = String::Unbox(IString::Query(value));
|
||||
std::string str = AAFwk::String::Unbox(AAFwk::IString::Query(value));
|
||||
if (std::regex_match(str, NUMBER_REGEX)) {
|
||||
return std::atoll(str.c_str());
|
||||
}
|
||||
@ -960,15 +958,15 @@ long DistributedWant::GetLongParam(const std::string& key, long defaultValue) co
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
void ArrayAddData(IInterface* object, std::vector<long>& array)
|
||||
void ArrayAddData(AAFwk::IInterface* object, std::vector<long>& array)
|
||||
{
|
||||
if (object == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
IString* o = IString::Query(object);
|
||||
AAFwk::IString* o = AAFwk::IString::Query(object);
|
||||
if (o != nullptr) {
|
||||
std::string str = String::Unbox(o);
|
||||
std::string str = AAFwk::String::Unbox(o);
|
||||
if (std::regex_match(str, NUMBER_REGEX)) {
|
||||
array.push_back(std::atoll(str.c_str()));
|
||||
}
|
||||
@ -984,21 +982,21 @@ std::vector<long> DistributedWant::GetLongArrayParam(const std::string& key) con
|
||||
{
|
||||
std::vector<long> array;
|
||||
auto value = parameters_.GetParam(key);
|
||||
IArray* ao = IArray::Query(value);
|
||||
if (ao != nullptr && Array::IsLongArray(ao)) {
|
||||
auto func = [&](IInterface* object) {
|
||||
AAFwk::IArray* ao = AAFwk::IArray::Query(value);
|
||||
if (ao != nullptr && AAFwk::Array::IsLongArray(ao)) {
|
||||
auto func = [&](AAFwk::IInterface* object) {
|
||||
if (object != nullptr) {
|
||||
ILong* value = ILong::Query(object);
|
||||
AAFwk::ILong* value = AAFwk::ILong::Query(object);
|
||||
if (value != nullptr) {
|
||||
array.push_back(Long::Unbox(value));
|
||||
array.push_back(AAFwk::Long::Unbox(value));
|
||||
}
|
||||
}
|
||||
};
|
||||
Array::ForEach(ao, func);
|
||||
} else if (ao != nullptr && Array::IsStringArray(ao)) {
|
||||
AAFwk::Array::ForEach(ao, func);
|
||||
} else if (ao != nullptr && AAFwk::Array::IsStringArray(ao)) {
|
||||
// Marshalling
|
||||
auto func = [&](IInterface* object) { ArrayAddData(object, array); };
|
||||
Array::ForEach(ao, func);
|
||||
auto func = [&](AAFwk::IInterface* object) { ArrayAddData(object, array); };
|
||||
AAFwk::Array::ForEach(ao, func);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
@ -1011,7 +1009,7 @@ std::vector<long> DistributedWant::GetLongArrayParam(const std::string& key) con
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, long value)
|
||||
{
|
||||
parameters_.SetParam(key, Long::Box(value));
|
||||
parameters_.SetParam(key, AAFwk::Long::Box(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1024,12 +1022,12 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, long value)
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<long>& value)
|
||||
{
|
||||
std::size_t size = value.size();
|
||||
sptr<IArray> ao = new (std::nothrow) Array(size, g_IID_ILong);
|
||||
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_ILong);
|
||||
if (ao == nullptr) {
|
||||
return *this;
|
||||
}
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
ao->Set(i, Long::Box(value[i]));
|
||||
ao->Set(i, AAFwk::Long::Box(value[i]));
|
||||
}
|
||||
parameters_.SetParam(key, ao);
|
||||
return *this;
|
||||
@ -1037,7 +1035,7 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, const std::ve
|
||||
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, long long value)
|
||||
{
|
||||
parameters_.SetParam(key, Long::Box(value));
|
||||
parameters_.SetParam(key, AAFwk::Long::Box(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1051,9 +1049,9 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, long long val
|
||||
short DistributedWant::GetShortParam(const std::string& key, short defaultValue) const
|
||||
{
|
||||
auto value = parameters_.GetParam(key);
|
||||
IShort* ao = IShort::Query(value);
|
||||
AAFwk::IShort* ao = AAFwk::IShort::Query(value);
|
||||
if (ao != nullptr) {
|
||||
return Short::Unbox(ao);
|
||||
return AAFwk::Short::Unbox(ao);
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
@ -1068,17 +1066,17 @@ std::vector<short> DistributedWant::GetShortArrayParam(const std::string& key) c
|
||||
{
|
||||
std::vector<short> array;
|
||||
auto value = parameters_.GetParam(key);
|
||||
IArray* ao = IArray::Query(value);
|
||||
if (ao != nullptr && Array::IsShortArray(ao)) {
|
||||
auto func = [&](IInterface* object) {
|
||||
AAFwk::IArray* ao = AAFwk::IArray::Query(value);
|
||||
if (ao != nullptr && AAFwk::Array::IsShortArray(ao)) {
|
||||
auto func = [&](AAFwk::IInterface* object) {
|
||||
if (object != nullptr) {
|
||||
IShort* value = IShort::Query(object);
|
||||
AAFwk::IShort* value = AAFwk::IShort::Query(object);
|
||||
if (value != nullptr) {
|
||||
array.push_back(Short::Unbox(value));
|
||||
array.push_back(AAFwk::Short::Unbox(value));
|
||||
}
|
||||
}
|
||||
};
|
||||
Array::ForEach(ao, func);
|
||||
AAFwk::Array::ForEach(ao, func);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
@ -1091,7 +1089,7 @@ std::vector<short> DistributedWant::GetShortArrayParam(const std::string& key) c
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, short value)
|
||||
{
|
||||
parameters_.SetParam(key, Short::Box(value));
|
||||
parameters_.SetParam(key, AAFwk::Short::Box(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1104,12 +1102,12 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, short value)
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<short>& value)
|
||||
{
|
||||
std::size_t size = value.size();
|
||||
sptr<IArray> ao = new (std::nothrow) Array(size, g_IID_IShort);
|
||||
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IShort);
|
||||
if (ao == nullptr) {
|
||||
return *this;
|
||||
}
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
ao->Set(i, Short::Box(value[i]));
|
||||
ao->Set(i, AAFwk::Short::Box(value[i]));
|
||||
}
|
||||
parameters_.SetParam(key, ao);
|
||||
return *this;
|
||||
@ -1124,9 +1122,9 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, const std::ve
|
||||
std::string DistributedWant::GetStringParam(const std::string& key) const
|
||||
{
|
||||
auto value = parameters_.GetParam(key);
|
||||
IString* ao = IString::Query(value);
|
||||
AAFwk::IString* ao = AAFwk::IString::Query(value);
|
||||
if (ao != nullptr) {
|
||||
return String::Unbox(ao);
|
||||
return AAFwk::String::Unbox(ao);
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
@ -1141,17 +1139,17 @@ std::vector<std::string> DistributedWant::GetStringArrayParam(const std::string&
|
||||
{
|
||||
std::vector<std::string> array;
|
||||
auto value = parameters_.GetParam(key);
|
||||
IArray* ao = IArray::Query(value);
|
||||
if (ao != nullptr && Array::IsStringArray(ao)) {
|
||||
auto func = [&](IInterface* object) {
|
||||
AAFwk::IArray* ao = AAFwk::IArray::Query(value);
|
||||
if (ao != nullptr && AAFwk::Array::IsStringArray(ao)) {
|
||||
auto func = [&](AAFwk::IInterface* object) {
|
||||
if (object != nullptr) {
|
||||
IString* value = IString::Query(object);
|
||||
AAFwk::IString* value = AAFwk::IString::Query(object);
|
||||
if (value != nullptr) {
|
||||
array.push_back(String::Unbox(value));
|
||||
array.push_back(AAFwk::String::Unbox(value));
|
||||
}
|
||||
}
|
||||
};
|
||||
Array::ForEach(ao, func);
|
||||
AAFwk::Array::ForEach(ao, func);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
@ -1164,7 +1162,7 @@ std::vector<std::string> DistributedWant::GetStringArrayParam(const std::string&
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::string& value)
|
||||
{
|
||||
parameters_.SetParam(key, String::Box(value));
|
||||
parameters_.SetParam(key, AAFwk::String::Box(value));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1177,12 +1175,12 @@ DistributedWant& DistributedWant::SetParam(const std::string& key, const std::st
|
||||
DistributedWant& DistributedWant::SetParam(const std::string& key, const std::vector<std::string>& value)
|
||||
{
|
||||
std::size_t size = value.size();
|
||||
sptr<IArray> ao = new (std::nothrow) Array(size, g_IID_IString);
|
||||
sptr<AAFwk::IArray> ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IString);
|
||||
if (ao == nullptr) {
|
||||
return *this;
|
||||
}
|
||||
for (std::size_t i = 0; i < size; i++) {
|
||||
ao->Set(i, String::Box(value[i]));
|
||||
ao->Set(i, AAFwk::String::Box(value[i]));
|
||||
}
|
||||
parameters_.SetParam(key, ao);
|
||||
return *this;
|
||||
@ -1201,7 +1199,7 @@ DistributedOperation DistributedWant::GetOperation() const
|
||||
* @description: Sets the description of an operation in a DistributedWant.
|
||||
* @param operation Indicates the operation description.
|
||||
*/
|
||||
void DistributedWant::SetOperation(const OHOS::AAFwk::DistributedOperation& operation)
|
||||
void DistributedWant::SetOperation(const DistributedOperation& operation)
|
||||
{
|
||||
operation_ = operation;
|
||||
}
|
||||
@ -1222,7 +1220,7 @@ bool DistributedWant::OperationEquals(const DistributedWant& want)
|
||||
*/
|
||||
DistributedWant* DistributedWant::CloneOperation()
|
||||
{
|
||||
DistributedWant*want = new (std::nothrow) DistributedWant();
|
||||
DistributedWant* want = new (std::nothrow) DistributedWant();
|
||||
if (want == nullptr) {
|
||||
return nullptr;
|
||||
}
|
||||
@ -1327,7 +1325,7 @@ std::string DistributedWant::GetUriString() const
|
||||
* @description: Obtains the description of a URI in a DistributedWant.
|
||||
* @return Returns the URI description in the DistributedWant.
|
||||
*/
|
||||
Uri DistributedWant::GetUri() const
|
||||
OHOS::Uri DistributedWant::GetUri() const
|
||||
{
|
||||
return operation_.GetUri();
|
||||
}
|
||||
@ -1339,7 +1337,7 @@ Uri DistributedWant::GetUri() const
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetUri(const std::string& uri)
|
||||
{
|
||||
operation_.SetUri(Uri(uri));
|
||||
operation_.SetUri(OHOS::Uri(uri));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1348,7 +1346,7 @@ DistributedWant& DistributedWant::SetUri(const std::string& uri)
|
||||
* @param uri Indicates the URI description.
|
||||
* @return Returns this DistributedWant object containing the URI.
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetUri(const Uri& uri)
|
||||
DistributedWant& DistributedWant::SetUri(const OHOS::Uri& uri)
|
||||
{
|
||||
operation_.SetUri(uri);
|
||||
return *this;
|
||||
@ -1360,7 +1358,7 @@ DistributedWant& DistributedWant::SetUri(const Uri& uri)
|
||||
* @param type Indicates the type description.
|
||||
* @return Returns this DistributedWant object containing the URI and the type.
|
||||
*/
|
||||
DistributedWant& DistributedWant::SetUriAndType(const Uri& uri, const std::string& type)
|
||||
DistributedWant& DistributedWant::SetUriAndType(const OHOS::Uri& uri, const std::string& type)
|
||||
{
|
||||
operation_.SetUri(uri);
|
||||
return SetType(type);
|
||||
@ -1427,29 +1425,29 @@ void DistributedWant::ToUriStringInner(std::string& uriString) const
|
||||
auto params = parameters_.GetParams();
|
||||
auto iter = params.cbegin();
|
||||
while (iter != params.cend()) {
|
||||
sptr<IInterface> o = iter->second;
|
||||
if (IString::Query(o) != nullptr) {
|
||||
uriString += String::SIGNATURE;
|
||||
} else if (IBoolean::Query(o) != nullptr) {
|
||||
uriString += Boolean::SIGNATURE;
|
||||
} else if (IChar::Query(o) != nullptr) {
|
||||
uriString += Char::SIGNATURE;
|
||||
} else if (IByte::Query(o) != nullptr) {
|
||||
uriString += Byte::SIGNATURE;
|
||||
} else if (IShort::Query(o) != nullptr) {
|
||||
uriString += Short::SIGNATURE;
|
||||
} else if (IInteger::Query(o) != nullptr) {
|
||||
uriString += Integer::SIGNATURE;
|
||||
} else if (ILong::Query(o) != nullptr) {
|
||||
uriString += Long::SIGNATURE;
|
||||
} else if (IFloat::Query(o) != nullptr) {
|
||||
uriString += Float::SIGNATURE;
|
||||
} else if (IDouble::Query(o) != nullptr) {
|
||||
uriString += Double::SIGNATURE;
|
||||
} else if (IArray::Query(o) != nullptr) {
|
||||
uriString += Array::SIGNATURE;
|
||||
sptr<AAFwk::IInterface> o = iter->second;
|
||||
if (AAFwk::IString::Query(o) != nullptr) {
|
||||
uriString += AAFwk::String::SIGNATURE;
|
||||
} else if (AAFwk::IBoolean::Query(o) != nullptr) {
|
||||
uriString += AAFwk::Boolean::SIGNATURE;
|
||||
} else if (AAFwk::IChar::Query(o) != nullptr) {
|
||||
uriString += AAFwk::Char::SIGNATURE;
|
||||
} else if (AAFwk::IByte::Query(o) != nullptr) {
|
||||
uriString += AAFwk::Byte::SIGNATURE;
|
||||
} else if (AAFwk::IShort::Query(o) != nullptr) {
|
||||
uriString += AAFwk::Short::SIGNATURE;
|
||||
} else if (AAFwk::IInteger::Query(o) != nullptr) {
|
||||
uriString += AAFwk::Integer::SIGNATURE;
|
||||
} else if (AAFwk::ILong::Query(o) != nullptr) {
|
||||
uriString += AAFwk::Long::SIGNATURE;
|
||||
} else if (AAFwk::IFloat::Query(o) != nullptr) {
|
||||
uriString += AAFwk::Float::SIGNATURE;
|
||||
} else if (AAFwk::IDouble::Query(o) != nullptr) {
|
||||
uriString += AAFwk::Double::SIGNATURE;
|
||||
} else if (AAFwk::IArray::Query(o) != nullptr) {
|
||||
uriString += AAFwk::Array::SIGNATURE;
|
||||
}
|
||||
uriString += "." + Encode(iter->first) + "=" + Encode(Object::ToString(*(o.GetRefPtr()))) + ";";
|
||||
uriString += "." + Encode(iter->first) + "=" + Encode(AAFwk::Object::ToString(*(o.GetRefPtr()))) + ";";
|
||||
iter++;
|
||||
}
|
||||
}
|
||||
@ -1462,7 +1460,7 @@ void DistributedWant::ToUriStringInner(std::string& uriString) const
|
||||
*/
|
||||
DistributedWant& DistributedWant::FormatUri(const std::string& uri)
|
||||
{
|
||||
return FormatUri(Uri(uri));
|
||||
return FormatUri(OHOS::Uri(uri));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1472,7 +1470,7 @@ DistributedWant& DistributedWant::FormatUri(const std::string& uri)
|
||||
* @param uri Indicates the URI to format.
|
||||
* @return Returns this DistributedWant object that contains the formatted uri attribute.
|
||||
*/
|
||||
DistributedWant& DistributedWant::FormatUri(const Uri& uri)
|
||||
DistributedWant& DistributedWant::FormatUri(const OHOS::Uri& uri)
|
||||
{
|
||||
operation_.SetUri(GetLowerCaseScheme(uri));
|
||||
return *this;
|
||||
@ -1530,7 +1528,7 @@ void DistributedWant::ClearWant(DistributedWant* want)
|
||||
want->SetFlags(0);
|
||||
OHOS::AppExecFwk::ElementName elementName;
|
||||
want->SetElement(elementName);
|
||||
OHOS::AAFwk::DistributedOperation operation;
|
||||
DistributedOperation operation;
|
||||
want->SetOperation(operation);
|
||||
DistributedWantParams parameters;
|
||||
want->SetParams(parameters);
|
||||
@ -1834,62 +1832,62 @@ std::string DistributedWant::Encode(const std::string& str)
|
||||
bool DistributedWant::CheckAndSetParameters(DistributedWant& want, const std::string& key,
|
||||
std::string& prop, const std::string& value)
|
||||
{
|
||||
if (prop[0] == String::SIGNATURE && prop[1] == '.') {
|
||||
sptr<IString> valueObj = String::Parse(value);
|
||||
if (prop[0] == AAFwk::String::SIGNATURE && prop[1] == '.') {
|
||||
sptr<AAFwk::IString> valueObj = AAFwk::String::Parse(value);
|
||||
if (valueObj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
want.parameters_.SetParam(key, valueObj);
|
||||
} else if (prop[0] == Boolean::SIGNATURE && prop[1] == '.') {
|
||||
sptr<IBoolean> valueObj = Boolean::Parse(value);
|
||||
} else if (prop[0] == AAFwk::Boolean::SIGNATURE && prop[1] == '.') {
|
||||
sptr<AAFwk::IBoolean> valueObj = AAFwk::Boolean::Parse(value);
|
||||
if (valueObj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
want.parameters_.SetParam(key, valueObj);
|
||||
} else if (prop[0] == Char::SIGNATURE && prop[1] == '.') {
|
||||
sptr<IChar> valueObj = Char::Parse(value);
|
||||
} else if (prop[0] == AAFwk::Char::SIGNATURE && prop[1] == '.') {
|
||||
sptr<AAFwk::IChar> valueObj = AAFwk::Char::Parse(value);
|
||||
if (valueObj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
want.parameters_.SetParam(key, valueObj);
|
||||
} else if (prop[0] == Byte::SIGNATURE && prop[1] == '.') {
|
||||
sptr<IByte> valueObj = Byte::Parse(value);
|
||||
} else if (prop[0] == AAFwk::Byte::SIGNATURE && prop[1] == '.') {
|
||||
sptr<AAFwk::IByte> valueObj = AAFwk::Byte::Parse(value);
|
||||
if (valueObj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
want.parameters_.SetParam(key, valueObj);
|
||||
} else if (prop[0] == Short::SIGNATURE && prop[1] == '.') {
|
||||
sptr<IShort> valueObj = Short::Parse(value);
|
||||
} else if (prop[0] == AAFwk::Short::SIGNATURE && prop[1] == '.') {
|
||||
sptr<AAFwk::IShort> valueObj = AAFwk::Short::Parse(value);
|
||||
if (valueObj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
want.parameters_.SetParam(key, valueObj);
|
||||
} else if (prop[0] == Integer::SIGNATURE && prop[1] == '.') {
|
||||
sptr<IInteger> valueObj = Integer::Parse(value);
|
||||
} else if (prop[0] == AAFwk::Integer::SIGNATURE && prop[1] == '.') {
|
||||
sptr<AAFwk::IInteger> valueObj = AAFwk::Integer::Parse(value);
|
||||
if (valueObj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
want.parameters_.SetParam(key, valueObj);
|
||||
} else if (prop[0] == Long::SIGNATURE && prop[1] == '.') {
|
||||
sptr<ILong> valueObj = Long::Parse(value);
|
||||
} else if (prop[0] == AAFwk::Long::SIGNATURE && prop[1] == '.') {
|
||||
sptr<AAFwk::ILong> valueObj = AAFwk::Long::Parse(value);
|
||||
if (valueObj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
want.parameters_.SetParam(key, valueObj);
|
||||
} else if (prop[0] == Float::SIGNATURE && prop[1] == '.') {
|
||||
sptr<IFloat> valueObj = Float::Parse(value);
|
||||
} else if (prop[0] == AAFwk::Float::SIGNATURE && prop[1] == '.') {
|
||||
sptr<AAFwk::IFloat> valueObj = AAFwk::Float::Parse(value);
|
||||
if (valueObj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
want.parameters_.SetParam(key, valueObj);
|
||||
} else if (prop[0] == Double::SIGNATURE && prop[1] == '.') {
|
||||
sptr<IDouble> valueObj = Double::Parse(value);
|
||||
} else if (prop[0] == AAFwk::Double::SIGNATURE && prop[1] == '.') {
|
||||
sptr<AAFwk::IDouble> valueObj = AAFwk::Double::Parse(value);
|
||||
if (valueObj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
want.parameters_.SetParam(key, valueObj);
|
||||
} else if (prop[0] == Array::SIGNATURE && prop[1] == '.') {
|
||||
sptr<IArray> valueObj = Array::Parse(value);
|
||||
} else if (prop[0] == AAFwk::Array::SIGNATURE && prop[1] == '.') {
|
||||
sptr<AAFwk::IArray> valueObj = AAFwk::Array::Parse(value);
|
||||
if (valueObj == nullptr) {
|
||||
return false;
|
||||
}
|
||||
@ -1999,5 +1997,5 @@ DistributedWant& DistributedWant::SetDeviceId(const std::string& deviceId)
|
||||
operation_.SetDeviceId(deviceId);
|
||||
return *this;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
||||
|
@ -18,8 +18,8 @@
|
||||
#include "base_object.h"
|
||||
#include "bool_wrapper.h"
|
||||
#include "byte_wrapper.h"
|
||||
#include "distributedWant/distributed_want_params.h"
|
||||
#include "distributedWant/distributed_want_params_wrapper.h"
|
||||
#include "distributed_want_params.h"
|
||||
#include "distributed_want_params_wrapper.h"
|
||||
#include "double_wrapper.h"
|
||||
#include "float_wrapper.h"
|
||||
#include "int_wrapper.h"
|
||||
@ -33,7 +33,7 @@
|
||||
#include "zchar_wrapper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace DistributedSchedule {
|
||||
DistributedUnsupportedData::~DistributedUnsupportedData()
|
||||
{
|
||||
if (buffer != nullptr) {
|
||||
@ -100,28 +100,28 @@ DistributedUnsupportedData& DistributedUnsupportedData::operator=(DistributedUns
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::string DistributedWantParams::GetStringByType(const sptr<IInterface> iIt, int typeId)
|
||||
std::string DistributedWantParams::GetStringByType(const sptr<AAFwk::IInterface> iIt, int typeId)
|
||||
{
|
||||
if (typeId == VALUE_TYPE_BOOLEAN) {
|
||||
return static_cast<Boolean*>(IBoolean::Query(iIt))->ToString();
|
||||
return static_cast<AAFwk::Boolean*>(AAFwk::IBoolean::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_BYTE) {
|
||||
return static_cast<Byte*>(IByte::Query(iIt))->ToString();
|
||||
return static_cast<AAFwk::Byte*>(AAFwk::IByte::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_CHAR) {
|
||||
return static_cast<Char*>(IChar::Query(iIt))->ToString();
|
||||
return static_cast<AAFwk::Char*>(AAFwk::IChar::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_SHORT) {
|
||||
return static_cast<Short*>(IShort::Query(iIt))->ToString();
|
||||
return static_cast<AAFwk::Short*>(AAFwk::IShort::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_INT) {
|
||||
return static_cast<Integer*>(IInteger::Query(iIt))->ToString();
|
||||
return static_cast<AAFwk::Integer*>(AAFwk::IInteger::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_LONG) {
|
||||
return static_cast<Long*>(ILong::Query(iIt))->ToString();
|
||||
return static_cast<AAFwk::Long*>(AAFwk::ILong::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_FLOAT) {
|
||||
return static_cast<Float*>(IFloat::Query(iIt))->ToString();
|
||||
return static_cast<AAFwk::Float*>(AAFwk::IFloat::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_DOUBLE) {
|
||||
return static_cast<Double*>(IDouble::Query(iIt))->ToString();
|
||||
return static_cast<AAFwk::Double*>(AAFwk::IDouble::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_STRING) {
|
||||
return static_cast<String*>(IString::Query(iIt))->ToString();
|
||||
return static_cast<AAFwk::String*>(AAFwk::IString::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_ARRAY) {
|
||||
return static_cast<Array*>(IArray::Query(iIt))->ToString();
|
||||
return static_cast<AAFwk::Array*>(AAFwk::IArray::Query(iIt))->ToString();
|
||||
} else if (typeId == VALUE_TYPE_WANTPARAMS) {
|
||||
return static_cast<DistributedWantParamWrapper*>(IDistributedWantParams::Query(iIt))->ToString();
|
||||
} else {
|
||||
@ -147,30 +147,30 @@ bool DistributedWantParams::NewParams(const DistributedWantParams& source, Distr
|
||||
// Deep copy
|
||||
for (auto it = source.params_.begin(); it != source.params_.end(); it++) {
|
||||
sptr<IInterface> o = it->second;
|
||||
if (IString::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = String::Box(String::Unbox(IString::Query(o)));
|
||||
} else if (IBoolean::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = Boolean::Box(Boolean::Unbox(IBoolean::Query(o)));
|
||||
} else if (IByte::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = Byte::Box(Byte::Unbox(IByte::Query(o)));
|
||||
} else if (IChar::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = Char::Box(Char::Unbox(IChar::Query(o)));
|
||||
} else if (IShort::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = Short::Box(Short::Unbox(IShort::Query(o)));
|
||||
} else if (IInteger::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = Integer::Box(Integer::Unbox(IInteger::Query(o)));
|
||||
} else if (ILong::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = Long::Box(Long::Unbox(ILong::Query(o)));
|
||||
} else if (IFloat::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = Float::Box(Float::Unbox(IFloat::Query(o)));
|
||||
} else if (IDouble::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = Double::Box(Double::Unbox(IDouble::Query(o)));
|
||||
if (AAFwk::IString::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = AAFwk::String::Box(AAFwk::String::Unbox(AAFwk::IString::Query(o)));
|
||||
} else if (AAFwk::IBoolean::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = AAFwk::Boolean::Box(AAFwk::Boolean::Unbox(AAFwk::IBoolean::Query(o)));
|
||||
} else if (AAFwk::IByte::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = AAFwk::Byte::Box(AAFwk::Byte::Unbox(AAFwk::IByte::Query(o)));
|
||||
} else if (AAFwk::IChar::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = AAFwk::Char::Box(AAFwk::Char::Unbox(AAFwk::IChar::Query(o)));
|
||||
} else if (AAFwk::IShort::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = AAFwk::Short::Box(AAFwk::Short::Unbox(AAFwk::IShort::Query(o)));
|
||||
} else if (AAFwk::IInteger::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = AAFwk::Integer::Box(AAFwk::Integer::Unbox(AAFwk::IInteger::Query(o)));
|
||||
} else if (AAFwk::ILong::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = AAFwk::Long::Box(AAFwk::Long::Unbox(AAFwk::ILong::Query(o)));
|
||||
} else if (AAFwk::IFloat::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = AAFwk::Float::Box(AAFwk::Float::Unbox(AAFwk::IFloat::Query(o)));
|
||||
} else if (AAFwk::IDouble::Query(o) != nullptr) {
|
||||
dest.params_[it->first] = AAFwk::Double::Box(AAFwk::Double::Unbox(AAFwk::IDouble::Query(o)));
|
||||
} else if (IDistributedWantParams::Query(o) != nullptr) {
|
||||
DistributedWantParams newDest(DistributedWantParamWrapper::Unbox(IDistributedWantParams::Query(o)));
|
||||
dest.params_[it->first] = DistributedWantParamWrapper::Box(newDest);
|
||||
} else if (IArray::Query(o) != nullptr) {
|
||||
sptr<IArray> destAO = nullptr;
|
||||
if (!NewArrayData(IArray::Query(o), destAO)) {
|
||||
} else if (AAFwk::IArray::Query(o) != nullptr) {
|
||||
sptr<AAFwk::IArray> destAO = nullptr;
|
||||
if (!NewArrayData(AAFwk::IArray::Query(o), destAO)) {
|
||||
continue;
|
||||
}
|
||||
dest.params_[it->first] = destAO;
|
||||
@ -179,25 +179,25 @@ bool DistributedWantParams::NewParams(const DistributedWantParams& source, Distr
|
||||
return true;
|
||||
} // namespace AAFwk
|
||||
// inner use
|
||||
bool DistributedWantParams::NewArrayData(IArray* source, sptr<IArray>& dest)
|
||||
bool DistributedWantParams::NewArrayData(AAFwk::IArray* source, sptr<AAFwk::IArray>& dest)
|
||||
{
|
||||
if (Array::IsBooleanArray(source)) {
|
||||
if (AAFwk::Array::IsBooleanArray(source)) {
|
||||
SetNewArray<bool, AAFwk::Boolean, AAFwk::IBoolean>(AAFwk::g_IID_IBoolean, source, dest);
|
||||
} else if (Array::IsCharArray(source)) {
|
||||
} else if (AAFwk::Array::IsCharArray(source)) {
|
||||
SetNewArray<char, AAFwk::Char, AAFwk::IChar>(AAFwk::g_IID_IChar, source, dest);
|
||||
} else if (Array::IsByteArray(source)) {
|
||||
SetNewArray<byte, AAFwk::Byte, AAFwk::IByte>(AAFwk::g_IID_IByte, source, dest);
|
||||
} else if (Array::IsShortArray(source)) {
|
||||
} else if (AAFwk::Array::IsByteArray(source)) {
|
||||
SetNewArray<AAFwk::byte, AAFwk::Byte, AAFwk::IByte>(AAFwk::g_IID_IByte, source, dest);
|
||||
} else if (AAFwk::Array::IsShortArray(source)) {
|
||||
SetNewArray<short, AAFwk::Short, AAFwk::IShort>(AAFwk::g_IID_IShort, source, dest);
|
||||
} else if (Array::IsIntegerArray(source)) {
|
||||
} else if (AAFwk::Array::IsIntegerArray(source)) {
|
||||
SetNewArray<int, AAFwk::Integer, AAFwk::IInteger>(AAFwk::g_IID_IInteger, source, dest);
|
||||
} else if (Array::IsLongArray(source)) {
|
||||
} else if (AAFwk::Array::IsLongArray(source)) {
|
||||
SetNewArray<long, AAFwk::Long, AAFwk::ILong>(AAFwk::g_IID_ILong, source, dest);
|
||||
} else if (Array::IsFloatArray(source)) {
|
||||
} else if (AAFwk::Array::IsFloatArray(source)) {
|
||||
SetNewArray<float, AAFwk::Float, AAFwk::IFloat>(AAFwk::g_IID_IFloat, source, dest);
|
||||
} else if (Array::IsDoubleArray(source)) {
|
||||
} else if (AAFwk::Array::IsDoubleArray(source)) {
|
||||
SetNewArray<double, AAFwk::Double, AAFwk::IDouble>(AAFwk::g_IID_IDouble, source, dest);
|
||||
} else if (Array::IsStringArray(source)) {
|
||||
} else if (AAFwk::Array::IsStringArray(source)) {
|
||||
SetNewArray<std::string, AAFwk::String, AAFwk::IString>(AAFwk::g_IID_IString, source, dest);
|
||||
} else {
|
||||
return false;
|
||||
@ -241,25 +241,25 @@ bool DistributedWantParams::operator==(const DistributedWantParams& other)
|
||||
|
||||
int DistributedWantParams::GetDataType(const sptr<IInterface> iIt)
|
||||
{
|
||||
if (iIt != nullptr && IBoolean::Query(iIt) != nullptr) {
|
||||
if (iIt != nullptr && AAFwk::IBoolean::Query(iIt) != nullptr) {
|
||||
return VALUE_TYPE_BOOLEAN;
|
||||
} else if (iIt != nullptr && IByte::Query(iIt) != nullptr) {
|
||||
} else if (iIt != nullptr && AAFwk::IByte::Query(iIt) != nullptr) {
|
||||
return VALUE_TYPE_BYTE;
|
||||
} else if (iIt != nullptr && IChar::Query(iIt) != nullptr) {
|
||||
} else if (iIt != nullptr && AAFwk::IChar::Query(iIt) != nullptr) {
|
||||
return VALUE_TYPE_CHAR;
|
||||
} else if (iIt != nullptr && IShort::Query(iIt) != nullptr) {
|
||||
} else if (iIt != nullptr && AAFwk::IShort::Query(iIt) != nullptr) {
|
||||
return VALUE_TYPE_SHORT;
|
||||
} else if (iIt != nullptr && IInteger::Query(iIt) != nullptr) {
|
||||
} else if (iIt != nullptr && AAFwk::IInteger::Query(iIt) != nullptr) {
|
||||
return VALUE_TYPE_INT;
|
||||
} else if (iIt != nullptr && ILong::Query(iIt) != nullptr) {
|
||||
} else if (iIt != nullptr && AAFwk::ILong::Query(iIt) != nullptr) {
|
||||
return VALUE_TYPE_LONG;
|
||||
} else if (iIt != nullptr && IFloat::Query(iIt) != nullptr) {
|
||||
} else if (iIt != nullptr && AAFwk::IFloat::Query(iIt) != nullptr) {
|
||||
return VALUE_TYPE_FLOAT;
|
||||
} else if (iIt != nullptr && IDouble::Query(iIt) != nullptr) {
|
||||
} else if (iIt != nullptr && AAFwk::IDouble::Query(iIt) != nullptr) {
|
||||
return VALUE_TYPE_DOUBLE;
|
||||
} else if (iIt != nullptr && IString::Query(iIt) != nullptr) {
|
||||
} else if (iIt != nullptr && AAFwk::IString::Query(iIt) != nullptr) {
|
||||
return VALUE_TYPE_STRING;
|
||||
} else if (iIt != nullptr && IArray::Query(iIt) != nullptr) {
|
||||
} else if (iIt != nullptr && AAFwk::IArray::Query(iIt) != nullptr) {
|
||||
return VALUE_TYPE_ARRAY;
|
||||
} else if (iIt != nullptr && IDistributedWantParams::Query(iIt) != nullptr) {
|
||||
return VALUE_TYPE_WANTPARAMS;
|
||||
@ -271,25 +271,25 @@ int DistributedWantParams::GetDataType(const sptr<IInterface> iIt)
|
||||
sptr<IInterface> DistributedWantParams::GetInterfaceByType(int typeId, const std::string& value)
|
||||
{
|
||||
if (typeId == VALUE_TYPE_BOOLEAN) {
|
||||
return Boolean::Parse(value);
|
||||
return AAFwk::Boolean::Parse(value);
|
||||
} else if (typeId == VALUE_TYPE_BYTE) {
|
||||
return Byte::Parse(value);
|
||||
return AAFwk::Byte::Parse(value);
|
||||
} else if (typeId == VALUE_TYPE_CHAR) {
|
||||
return Char::Parse(value);
|
||||
return AAFwk::Char::Parse(value);
|
||||
} else if (typeId == VALUE_TYPE_SHORT) {
|
||||
return Short::Parse(value);
|
||||
return AAFwk::Short::Parse(value);
|
||||
} else if (typeId == VALUE_TYPE_INT) {
|
||||
return Integer::Parse(value);
|
||||
return AAFwk::Integer::Parse(value);
|
||||
} else if (typeId == VALUE_TYPE_LONG) {
|
||||
return Long::Parse(value);
|
||||
return AAFwk::Long::Parse(value);
|
||||
} else if (typeId == VALUE_TYPE_FLOAT) {
|
||||
return Float::Parse(value);
|
||||
return AAFwk::Float::Parse(value);
|
||||
} else if (typeId == VALUE_TYPE_DOUBLE) {
|
||||
return Double::Parse(value);
|
||||
return AAFwk::Double::Parse(value);
|
||||
} else if (typeId == VALUE_TYPE_STRING) {
|
||||
return String::Parse(value);
|
||||
return AAFwk::String::Parse(value);
|
||||
} else if (typeId == VALUE_TYPE_ARRAY) {
|
||||
return Array::Parse(value);
|
||||
return AAFwk::Array::Parse(value);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@ -300,36 +300,44 @@ bool DistributedWantParams::CompareInterface(const sptr<IInterface> iIt1, const
|
||||
bool flag = false;
|
||||
switch (typeId) {
|
||||
case VALUE_TYPE_BOOLEAN:
|
||||
flag =
|
||||
static_cast<Boolean*>(IBoolean::Query(iIt1))->Equals(*(static_cast<Boolean*>(IBoolean::Query(iIt1))));
|
||||
flag = static_cast<AAFwk::Boolean*>(AAFwk::IBoolean::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Boolean*>(AAFwk::IBoolean::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_BYTE:
|
||||
flag = static_cast<Byte*>(IByte::Query(iIt1))->Equals(*(static_cast<Byte*>(IByte::Query(iIt1))));
|
||||
flag = static_cast<AAFwk::Byte*>(AAFwk::IByte::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Byte*>(AAFwk::IByte::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_CHAR:
|
||||
flag = static_cast<Char*>(IChar::Query(iIt1))->Equals(*(static_cast<Char*>(IChar::Query(iIt1))));
|
||||
flag = static_cast<AAFwk::Char*>(AAFwk::IChar::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Char*>(AAFwk::IChar::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_SHORT:
|
||||
flag = static_cast<Short*>(IShort::Query(iIt1))->Equals(*(static_cast<Short*>(IShort::Query(iIt1))));
|
||||
flag = static_cast<AAFwk::Short*>(AAFwk::IShort::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Short*>(AAFwk::IShort::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_INT:
|
||||
flag =
|
||||
static_cast<Integer*>(IInteger::Query(iIt1))->Equals(*(static_cast<Integer*>(IInteger::Query(iIt1))));
|
||||
flag = static_cast<AAFwk::Integer*>(AAFwk::IInteger::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Integer*>(AAFwk::IInteger::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_LONG:
|
||||
flag = static_cast<Long*>(ILong::Query(iIt1))->Equals(*(static_cast<Long*>(ILong::Query(iIt1))));
|
||||
flag = static_cast<AAFwk::Long*>(AAFwk::ILong::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Long*>(AAFwk::ILong::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_FLOAT:
|
||||
flag = static_cast<Float*>(IFloat::Query(iIt1))->Equals(*(static_cast<Float*>(IFloat::Query(iIt1))));
|
||||
flag = static_cast<AAFwk::Float*>(AAFwk::IFloat::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Float*>(AAFwk::IFloat::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_DOUBLE:
|
||||
flag = static_cast<Double*>(IDouble::Query(iIt1))->Equals(*(static_cast<Double*>(IDouble::Query(iIt1))));
|
||||
flag = static_cast<AAFwk::Double*>(AAFwk::IDouble::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Double*>(AAFwk::IDouble::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_STRING:
|
||||
flag = static_cast<String*>(IString::Query(iIt1))->Equals(*(static_cast<String*>(IString::Query(iIt1))));
|
||||
flag = static_cast<AAFwk::String*>(AAFwk::IString::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::String*>(AAFwk::IString::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_ARRAY:
|
||||
flag = static_cast<Array*>(IArray::Query(iIt1))->Equals(*(static_cast<Array*>(IArray::Query(iIt1))));
|
||||
flag = static_cast<AAFwk::Array*>(AAFwk::IArray::Query(iIt1))
|
||||
->Equals(*(static_cast<AAFwk::Array*>(AAFwk::IArray::Query(iIt1))));
|
||||
break;
|
||||
case VALUE_TYPE_WANTPARAMS:
|
||||
flag = static_cast<DistributedWantParamWrapper*>(IDistributedWantParams::Query(iIt1))
|
||||
@ -431,7 +439,7 @@ bool DistributedWantParams::IsEmpty() const
|
||||
|
||||
bool DistributedWantParams::WriteToParcelString(Parcel& parcel, sptr<IInterface>& o) const
|
||||
{
|
||||
std::string value = String::Unbox(IString::Query(o));
|
||||
std::string value = AAFwk::String::Unbox(AAFwk::IString::Query(o));
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_STRING)) {
|
||||
return false;
|
||||
}
|
||||
@ -440,7 +448,7 @@ bool DistributedWantParams::WriteToParcelString(Parcel& parcel, sptr<IInterface>
|
||||
|
||||
bool DistributedWantParams::WriteToParcelBool(Parcel& parcel, sptr<IInterface>& o) const
|
||||
{
|
||||
bool value = Boolean::Unbox(IBoolean::Query(o));
|
||||
bool value = AAFwk::Boolean::Unbox(AAFwk::IBoolean::Query(o));
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_BOOLEAN)) {
|
||||
return false;
|
||||
}
|
||||
@ -457,7 +465,7 @@ bool DistributedWantParams::WriteToParcelWantParams(Parcel& parcel, sptr<IInterf
|
||||
}
|
||||
bool DistributedWantParams::WriteToParcelByte(Parcel& parcel, sptr<IInterface>& o) const
|
||||
{
|
||||
byte value = Byte::Unbox(IByte::Query(o));
|
||||
AAFwk::byte value = AAFwk::Byte::Unbox(AAFwk::IByte::Query(o));
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_BYTE)) {
|
||||
return false;
|
||||
}
|
||||
@ -466,7 +474,7 @@ bool DistributedWantParams::WriteToParcelByte(Parcel& parcel, sptr<IInterface>&
|
||||
|
||||
bool DistributedWantParams::WriteToParcelChar(Parcel& parcel, sptr<IInterface>& o) const
|
||||
{
|
||||
zchar value = Char::Unbox(IChar::Query(o));
|
||||
AAFwk::zchar value = AAFwk::Char::Unbox(AAFwk::IChar::Query(o));
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_CHAR)) {
|
||||
return false;
|
||||
}
|
||||
@ -475,7 +483,7 @@ bool DistributedWantParams::WriteToParcelChar(Parcel& parcel, sptr<IInterface>&
|
||||
|
||||
bool DistributedWantParams::WriteToParcelShort(Parcel& parcel, sptr<IInterface>& o) const
|
||||
{
|
||||
short value = Short::Unbox(IShort::Query(o));
|
||||
short value = AAFwk::Short::Unbox(AAFwk::IShort::Query(o));
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_SHORT)) {
|
||||
return false;
|
||||
}
|
||||
@ -484,7 +492,7 @@ bool DistributedWantParams::WriteToParcelShort(Parcel& parcel, sptr<IInterface>&
|
||||
|
||||
bool DistributedWantParams::WriteToParcelInt(Parcel& parcel, sptr<IInterface>& o) const
|
||||
{
|
||||
int value = Integer::Unbox(IInteger::Query(o));
|
||||
int value = AAFwk::Integer::Unbox(AAFwk::IInteger::Query(o));
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_INT)) {
|
||||
return false;
|
||||
}
|
||||
@ -493,7 +501,7 @@ bool DistributedWantParams::WriteToParcelInt(Parcel& parcel, sptr<IInterface>& o
|
||||
|
||||
bool DistributedWantParams::WriteToParcelLong(Parcel& parcel, sptr<IInterface>& o) const
|
||||
{
|
||||
long value = Long::Unbox(ILong::Query(o));
|
||||
long value = AAFwk::Long::Unbox(AAFwk::ILong::Query(o));
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_LONG)) {
|
||||
return false;
|
||||
}
|
||||
@ -502,7 +510,7 @@ bool DistributedWantParams::WriteToParcelLong(Parcel& parcel, sptr<IInterface>&
|
||||
|
||||
bool DistributedWantParams::WriteToParcelFloat(Parcel& parcel, sptr<IInterface>& o) const
|
||||
{
|
||||
float value = Float::Unbox(IFloat::Query(o));
|
||||
float value = AAFwk::Float::Unbox(AAFwk::IFloat::Query(o));
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_FLOAT)) {
|
||||
return false;
|
||||
}
|
||||
@ -511,7 +519,7 @@ bool DistributedWantParams::WriteToParcelFloat(Parcel& parcel, sptr<IInterface>&
|
||||
|
||||
bool DistributedWantParams::WriteToParcelDouble(Parcel& parcel, sptr<IInterface>& o) const
|
||||
{
|
||||
double value = Double::Unbox(IDouble::Query(o));
|
||||
double value = AAFwk::Double::Unbox(AAFwk::IDouble::Query(o));
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_DOUBLE)) {
|
||||
return false;
|
||||
}
|
||||
@ -520,30 +528,30 @@ bool DistributedWantParams::WriteToParcelDouble(Parcel& parcel, sptr<IInterface>
|
||||
|
||||
bool DistributedWantParams::WriteMarshalling(Parcel& parcel, sptr<IInterface>& o) const
|
||||
{
|
||||
if (IString::Query(o) != nullptr) {
|
||||
if (AAFwk::IString::Query(o) != nullptr) {
|
||||
return WriteToParcelString(parcel, o);
|
||||
} else if (IBoolean::Query(o) != nullptr) {
|
||||
} else if (AAFwk::IBoolean::Query(o) != nullptr) {
|
||||
return WriteToParcelBool(parcel, o);
|
||||
} else if (IByte::Query(o) != nullptr) {
|
||||
} else if (AAFwk::IByte::Query(o) != nullptr) {
|
||||
return WriteToParcelByte(parcel, o);
|
||||
} else if (IChar::Query(o) != nullptr) {
|
||||
} else if (AAFwk::IChar::Query(o) != nullptr) {
|
||||
return WriteToParcelChar(parcel, o);
|
||||
} else if (IShort::Query(o) != nullptr) {
|
||||
} else if (AAFwk::IShort::Query(o) != nullptr) {
|
||||
return WriteToParcelShort(parcel, o);
|
||||
} else if (IInteger::Query(o) != nullptr) {
|
||||
} else if (AAFwk::IInteger::Query(o) != nullptr) {
|
||||
return WriteToParcelInt(parcel, o);
|
||||
} else if (ILong::Query(o) != nullptr) {
|
||||
} else if (AAFwk::ILong::Query(o) != nullptr) {
|
||||
return WriteToParcelLong(parcel, o);
|
||||
} else if (IFloat::Query(o) != nullptr) {
|
||||
} else if (AAFwk::IFloat::Query(o) != nullptr) {
|
||||
return WriteToParcelFloat(parcel, o);
|
||||
} else if (IDouble::Query(o) != nullptr) {
|
||||
} else if (AAFwk::IDouble::Query(o) != nullptr) {
|
||||
return WriteToParcelDouble(parcel, o);
|
||||
} else if (IDistributedWantParams::Query(o) != nullptr) {
|
||||
return WriteToParcelWantParams(parcel, o);
|
||||
} else {
|
||||
IArray* ao = IArray::Query(o);
|
||||
AAFwk::IArray* ao = AAFwk::IArray::Query(o);
|
||||
if (ao != nullptr) {
|
||||
sptr<IArray> array(ao);
|
||||
sptr<AAFwk::IArray> array(ao);
|
||||
return WriteArrayToParcel(parcel, array);
|
||||
} else {
|
||||
return true;
|
||||
@ -565,7 +573,7 @@ bool DistributedWantParams::DoMarshalling(Parcel& parcel) const
|
||||
auto iter = params_.cbegin();
|
||||
while (iter != params_.cend()) {
|
||||
std::string key = iter->first;
|
||||
sptr<IInterface> o = iter->second;
|
||||
sptr<AAFwk::IInterface> o = iter->second;
|
||||
if (!parcel.WriteString16(Str8ToStr16(key))) {
|
||||
return false;
|
||||
}
|
||||
@ -632,10 +640,10 @@ bool DistributedWantParams::Marshalling(Parcel& parcel) const
|
||||
}
|
||||
|
||||
template<typename dataType, typename className>
|
||||
static bool SetArray(const InterfaceID& id, const std::vector<dataType>& value, sptr<IArray>& ao)
|
||||
static bool SetArray(const AAFwk::InterfaceID& id, const std::vector<dataType>& value, sptr<AAFwk::IArray>& ao)
|
||||
{
|
||||
typename std::vector<dataType>::size_type size = value.size();
|
||||
ao = new (std::nothrow) Array(size, id);
|
||||
ao = new (std::nothrow) AAFwk::Array(size, id);
|
||||
if (ao != nullptr) {
|
||||
for (typename std::vector<dataType>::size_type i = 0; i < size; i++) {
|
||||
ao->Set(i, className::Box(value[i]));
|
||||
@ -646,9 +654,9 @@ static bool SetArray(const InterfaceID& id, const std::vector<dataType>& value,
|
||||
}
|
||||
|
||||
template<typename T1, typename T2, typename T3>
|
||||
static void FillArray(IArray* ao, std::vector<T1>&array)
|
||||
static void FillArray(AAFwk::IArray* ao, std::vector<T1>&array)
|
||||
{
|
||||
auto func = [&](IInterface* object) {
|
||||
auto func = [&](AAFwk::IInterface* object) {
|
||||
if (object != nullptr) {
|
||||
T3* value = T3::Query(object);
|
||||
if (value != nullptr) {
|
||||
@ -656,7 +664,7 @@ static void FillArray(IArray* ao, std::vector<T1>&array)
|
||||
}
|
||||
}
|
||||
};
|
||||
Array::ForEach(ao, func);
|
||||
AAFwk::Array::ForEach(ao, func);
|
||||
}
|
||||
// inner use template function
|
||||
template<typename T1, typename T2, typename T3>
|
||||
@ -666,7 +674,7 @@ static void SetNewArray(const AAFwk::InterfaceID& id, AAFwk::IArray* orgIArray,
|
||||
return;
|
||||
}
|
||||
std::vector<T1> array;
|
||||
auto func = [&](IInterface* object) {
|
||||
auto func = [&](AAFwk::IInterface* object) {
|
||||
if (object != nullptr) {
|
||||
T3* value = T3::Query(object);
|
||||
if (value != nullptr) {
|
||||
@ -674,7 +682,7 @@ static void SetNewArray(const AAFwk::InterfaceID& id, AAFwk::IArray* orgIArray,
|
||||
}
|
||||
}
|
||||
};
|
||||
Array::ForEach(orgIArray, func);
|
||||
AAFwk::Array::ForEach(orgIArray, func);
|
||||
|
||||
typename std::vector<T1>::size_type size = array.size();
|
||||
if (size > 0) {
|
||||
@ -687,7 +695,7 @@ static void SetNewArray(const AAFwk::InterfaceID& id, AAFwk::IArray* orgIArray,
|
||||
}
|
||||
}
|
||||
|
||||
bool DistributedWantParams::WriteArrayToParcelString(Parcel& parcel, IArray* ao) const
|
||||
bool DistributedWantParams::WriteArrayToParcelString(Parcel& parcel, AAFwk::IArray* ao) const
|
||||
{
|
||||
if (ao == nullptr) {
|
||||
return false;
|
||||
@ -695,11 +703,11 @@ bool DistributedWantParams::WriteArrayToParcelString(Parcel& parcel, IArray* ao)
|
||||
|
||||
std::vector<std::u16string> array;
|
||||
auto func = [&](IInterface* object) {
|
||||
std::string s = String::Unbox(IString::Query(object));
|
||||
std::string s = AAFwk::String::Unbox(AAFwk::IString::Query(object));
|
||||
array.push_back(Str8ToStr16(s));
|
||||
};
|
||||
|
||||
Array::ForEach(ao, func);
|
||||
AAFwk::Array::ForEach(ao, func);
|
||||
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_STRINGARRAY)) {
|
||||
return false;
|
||||
@ -707,7 +715,7 @@ bool DistributedWantParams::WriteArrayToParcelString(Parcel& parcel, IArray* ao)
|
||||
return parcel.WriteString16Vector(array);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::WriteArrayToParcelBool(Parcel& parcel, IArray* ao) const
|
||||
bool DistributedWantParams::WriteArrayToParcelBool(Parcel& parcel, AAFwk::IArray* ao) const
|
||||
{
|
||||
if (ao == nullptr) {
|
||||
return false;
|
||||
@ -715,7 +723,7 @@ bool DistributedWantParams::WriteArrayToParcelBool(Parcel& parcel, IArray* ao) c
|
||||
|
||||
std::vector<int8_t> array;
|
||||
std::vector<int32_t> intArray;
|
||||
FillArray<int8_t, Boolean, IBoolean>(ao, array);
|
||||
FillArray<int8_t, AAFwk::Boolean, AAFwk::IBoolean>(ao, array);
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_BOOLEANARRAY)) {
|
||||
return false;
|
||||
}
|
||||
@ -726,130 +734,130 @@ bool DistributedWantParams::WriteArrayToParcelBool(Parcel& parcel, IArray* ao) c
|
||||
return parcel.WriteInt32Vector(intArray);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::WriteArrayToParcelByte(Parcel& parcel, IArray* ao) const
|
||||
bool DistributedWantParams::WriteArrayToParcelByte(Parcel& parcel, AAFwk::IArray* ao) const
|
||||
{
|
||||
if (ao == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<int8_t> array;
|
||||
FillArray<int8_t, Byte, IByte>(ao, array);
|
||||
FillArray<int8_t, AAFwk::Byte, AAFwk::IByte>(ao, array);
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_BYTEARRAY)) {
|
||||
return false;
|
||||
}
|
||||
return parcel.WriteInt8Vector(array);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::WriteArrayToParcelChar(Parcel& parcel, IArray* ao) const
|
||||
bool DistributedWantParams::WriteArrayToParcelChar(Parcel& parcel, AAFwk::IArray* ao) const
|
||||
{
|
||||
if (ao == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<int32_t> array;
|
||||
FillArray<int32_t, Char, IChar>(ao, array);
|
||||
FillArray<int32_t, AAFwk::Char, AAFwk::IChar>(ao, array);
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_CHARARRAY)) {
|
||||
return false;
|
||||
}
|
||||
return parcel.WriteInt32Vector(array);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::WriteArrayToParcelShort(Parcel& parcel, IArray* ao) const
|
||||
bool DistributedWantParams::WriteArrayToParcelShort(Parcel& parcel, AAFwk::IArray* ao) const
|
||||
{
|
||||
if (ao == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<short> array;
|
||||
FillArray<short, Short, IShort>(ao, array);
|
||||
FillArray<short, AAFwk::Short, AAFwk::IShort>(ao, array);
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_SHORTARRAY)) {
|
||||
return false;
|
||||
}
|
||||
return parcel.WriteInt16Vector(array);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::WriteArrayToParcelInt(Parcel& parcel, IArray* ao) const
|
||||
bool DistributedWantParams::WriteArrayToParcelInt(Parcel& parcel, AAFwk::IArray* ao) const
|
||||
{
|
||||
if (ao == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<int> array;
|
||||
FillArray<int, Integer, IInteger>(ao, array);
|
||||
FillArray<int, AAFwk::Integer, AAFwk::IInteger>(ao, array);
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_INTARRAY)) {
|
||||
return false;
|
||||
}
|
||||
return parcel.WriteInt32Vector(array);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::WriteArrayToParcelLong(Parcel& parcel, IArray* ao) const
|
||||
bool DistributedWantParams::WriteArrayToParcelLong(Parcel& parcel, AAFwk::IArray* ao) const
|
||||
{
|
||||
if (ao == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<int64_t> array;
|
||||
FillArray<int64_t, Long, ILong>(ao, array);
|
||||
FillArray<int64_t, AAFwk::Long, AAFwk::ILong>(ao, array);
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_LONGARRAY)) {
|
||||
return false;
|
||||
}
|
||||
return parcel.WriteInt64Vector(array);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::WriteArrayToParcelFloat(Parcel& parcel, IArray* ao) const
|
||||
bool DistributedWantParams::WriteArrayToParcelFloat(Parcel& parcel, AAFwk::IArray* ao) const
|
||||
{
|
||||
if (ao == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<float> array;
|
||||
FillArray<float, Float, IFloat>(ao, array);
|
||||
FillArray<float, AAFwk::Float, AAFwk::IFloat>(ao, array);
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_FLOATARRAY)) {
|
||||
return false;
|
||||
}
|
||||
return parcel.WriteFloatVector(array);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::WriteArrayToParcelDouble(Parcel& parcel, IArray* ao) const
|
||||
bool DistributedWantParams::WriteArrayToParcelDouble(Parcel& parcel, AAFwk::IArray* ao) const
|
||||
{
|
||||
if (ao == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<double> array;
|
||||
FillArray<double, Double, IDouble>(ao, array);
|
||||
FillArray<double, AAFwk::Double, AAFwk::IDouble>(ao, array);
|
||||
if (!parcel.WriteInt32(VALUE_TYPE_DOUBLEARRAY)) {
|
||||
return false;
|
||||
}
|
||||
return parcel.WriteDoubleVector(array);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::WriteArrayToParcel(Parcel& parcel, IArray* ao) const
|
||||
bool DistributedWantParams::WriteArrayToParcel(Parcel& parcel, AAFwk::IArray* ao) const
|
||||
{
|
||||
if (Array::IsStringArray(ao)) {
|
||||
if (AAFwk::Array::IsStringArray(ao)) {
|
||||
return WriteArrayToParcelString(parcel, ao);
|
||||
} else if (Array::IsBooleanArray(ao)) {
|
||||
} else if (AAFwk::Array::IsBooleanArray(ao)) {
|
||||
return WriteArrayToParcelBool(parcel, ao);
|
||||
} else if (Array::IsByteArray(ao)) {
|
||||
} else if (AAFwk::Array::IsByteArray(ao)) {
|
||||
return WriteArrayToParcelByte(parcel, ao);
|
||||
} else if (Array::IsCharArray(ao)) {
|
||||
} else if (AAFwk::Array::IsCharArray(ao)) {
|
||||
return WriteArrayToParcelChar(parcel, ao);
|
||||
} else if (Array::IsShortArray(ao)) {
|
||||
} else if (AAFwk::Array::IsShortArray(ao)) {
|
||||
return WriteArrayToParcelShort(parcel, ao);
|
||||
} else if (Array::IsIntegerArray(ao)) {
|
||||
} else if (AAFwk::Array::IsIntegerArray(ao)) {
|
||||
return WriteArrayToParcelInt(parcel, ao);
|
||||
} else if (Array::IsLongArray(ao)) {
|
||||
} else if (AAFwk::Array::IsLongArray(ao)) {
|
||||
return WriteArrayToParcelLong(parcel, ao);
|
||||
} else if (Array::IsFloatArray(ao)) {
|
||||
} else if (AAFwk::Array::IsFloatArray(ao)) {
|
||||
return WriteArrayToParcelFloat(parcel, ao);
|
||||
} else if (Array::IsDoubleArray(ao)) {
|
||||
} else if (AAFwk::Array::IsDoubleArray(ao)) {
|
||||
return WriteArrayToParcelDouble(parcel, ao);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool DistributedWantParams::ReadFromParcelArrayString(Parcel& parcel, sptr<IArray>& ao)
|
||||
bool DistributedWantParams::ReadFromParcelArrayString(Parcel& parcel, sptr<AAFwk::IArray>& ao)
|
||||
{
|
||||
std::vector<std::u16string> value;
|
||||
if (!parcel.ReadString16Vector(&value)) {
|
||||
@ -857,17 +865,17 @@ bool DistributedWantParams::ReadFromParcelArrayString(Parcel& parcel, sptr<IArra
|
||||
}
|
||||
|
||||
std::vector<std::u16string>::size_type size = value.size();
|
||||
ao = new (std::nothrow) Array(size, g_IID_IString);
|
||||
ao = new (std::nothrow) AAFwk::Array(size, AAFwk::g_IID_IString);
|
||||
if (ao != nullptr) {
|
||||
for (std::vector<std::u16string>::size_type i = 0; i < size; i++) {
|
||||
ao->Set(i, String::Box(Str16ToStr8(value[i])));
|
||||
ao->Set(i, AAFwk::String::Box(Str16ToStr8(value[i])));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DistributedWantParams::ReadFromParcelArrayBool(Parcel& parcel, sptr<IArray>& ao)
|
||||
bool DistributedWantParams::ReadFromParcelArrayBool(Parcel& parcel, sptr<AAFwk::IArray>& ao)
|
||||
{
|
||||
std::vector<int32_t> value;
|
||||
std::vector<int8_t> boolValue;
|
||||
@ -879,46 +887,46 @@ bool DistributedWantParams::ReadFromParcelArrayBool(Parcel& parcel, sptr<IArray>
|
||||
for (std::vector<int32_t>::size_type i = 0; i < size; i++) {
|
||||
boolValue.push_back(value[i]);
|
||||
}
|
||||
return SetArray<int8_t, Boolean>(g_IID_IBoolean, boolValue, ao);
|
||||
return SetArray<int8_t, AAFwk::Boolean>(AAFwk::g_IID_IBoolean, boolValue, ao);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::ReadFromParcelArrayByte(Parcel& parcel, sptr<IArray>& ao)
|
||||
bool DistributedWantParams::ReadFromParcelArrayByte(Parcel& parcel, sptr<AAFwk::IArray>& ao)
|
||||
{
|
||||
std::vector<int8_t> value;
|
||||
if (!parcel.ReadInt8Vector(&value)) {
|
||||
return false;
|
||||
}
|
||||
return SetArray<int8_t, Byte>(g_IID_IByte, value, ao);
|
||||
return SetArray<int8_t, AAFwk::Byte>(AAFwk::g_IID_IByte, value, ao);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::ReadFromParcelArrayChar(Parcel& parcel, sptr<IArray>& ao)
|
||||
bool DistributedWantParams::ReadFromParcelArrayChar(Parcel& parcel, sptr<AAFwk::IArray>& ao)
|
||||
{
|
||||
std::vector<int32_t> value;
|
||||
if (!parcel.ReadInt32Vector(&value)) {
|
||||
return false;
|
||||
}
|
||||
return SetArray<int32_t, Char>(g_IID_IChar, value, ao);
|
||||
return SetArray<int32_t, AAFwk::Char>(AAFwk::g_IID_IChar, value, ao);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::ReadFromParcelArrayShort(Parcel& parcel, sptr<IArray>& ao)
|
||||
bool DistributedWantParams::ReadFromParcelArrayShort(Parcel& parcel, sptr<AAFwk::IArray>& ao)
|
||||
{
|
||||
std::vector<short> value;
|
||||
if (!parcel.ReadInt16Vector(&value)) {
|
||||
return false;
|
||||
}
|
||||
return SetArray<short, Short>(g_IID_IShort, value, ao);
|
||||
return SetArray<short, AAFwk::Short>(AAFwk::g_IID_IShort, value, ao);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::ReadFromParcelArrayInt(Parcel& parcel, sptr<IArray>& ao)
|
||||
bool DistributedWantParams::ReadFromParcelArrayInt(Parcel& parcel, sptr<AAFwk::IArray>& ao)
|
||||
{
|
||||
std::vector<int> value;
|
||||
if (!parcel.ReadInt32Vector(&value)) {
|
||||
return false;
|
||||
}
|
||||
return SetArray<int, Integer>(g_IID_IInteger, value, ao);
|
||||
return SetArray<int, AAFwk::Integer>(AAFwk::g_IID_IInteger, value, ao);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::ReadFromParcelArrayLong(Parcel& parcel, sptr<IArray>& ao)
|
||||
bool DistributedWantParams::ReadFromParcelArrayLong(Parcel& parcel, sptr<AAFwk::IArray>& ao)
|
||||
{
|
||||
std::vector<int64_t> value;
|
||||
if (!parcel.ReadInt64Vector(&value)) {
|
||||
@ -932,29 +940,29 @@ bool DistributedWantParams::ReadFromParcelArrayLong(Parcel& parcel, sptr<IArray>
|
||||
for (size_t i = 0; i < value.size(); i++) {
|
||||
strList.push_back(std::to_string(value[i]));
|
||||
}
|
||||
return SetArray<std::string, String>(g_IID_IString, strList, ao);
|
||||
return SetArray<std::string, AAFwk::String>(AAFwk::g_IID_IString, strList, ao);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool DistributedWantParams::ReadFromParcelArrayFloat(Parcel& parcel, sptr<IArray>& ao)
|
||||
bool DistributedWantParams::ReadFromParcelArrayFloat(Parcel& parcel, sptr<AAFwk::IArray>& ao)
|
||||
{
|
||||
std::vector<float> value;
|
||||
if (!parcel.ReadFloatVector(&value)) {
|
||||
return false;
|
||||
}
|
||||
return SetArray<float, Float>(g_IID_IFloat, value, ao);
|
||||
return SetArray<float, AAFwk::Float>(AAFwk::g_IID_IFloat, value, ao);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::ReadFromParcelArrayDouble(Parcel& parcel, sptr<IArray>& ao)
|
||||
bool DistributedWantParams::ReadFromParcelArrayDouble(Parcel& parcel, sptr<AAFwk::IArray>& ao)
|
||||
{
|
||||
std::vector<double> value;
|
||||
if (!parcel.ReadDoubleVector(&value)) {
|
||||
return false;
|
||||
}
|
||||
return SetArray<double, Double>(g_IID_IDouble, value, ao);
|
||||
return SetArray<double, AAFwk::Double>(AAFwk::g_IID_IDouble, value, ao);
|
||||
}
|
||||
|
||||
bool DistributedWantParams::ReadArrayToParcel(Parcel& parcel, int type, sptr<IArray>& ao)
|
||||
bool DistributedWantParams::ReadArrayToParcel(Parcel& parcel, int type, sptr<AAFwk::IArray>& ao)
|
||||
{
|
||||
switch (type) {
|
||||
case VALUE_TYPE_STRINGARRAY:
|
||||
@ -987,7 +995,7 @@ bool DistributedWantParams::ReadFromParcelString(Parcel& parcel, const std::stri
|
||||
{
|
||||
std::u16string value = parcel.ReadString16();
|
||||
std::string strValue(Str16ToStr8(value));
|
||||
sptr<IInterface> intf = String::Box(Str16ToStr8(value));
|
||||
sptr<IInterface> intf = AAFwk::String::Box(Str16ToStr8(value));
|
||||
if (intf) {
|
||||
SetParam(key, intf);
|
||||
}
|
||||
@ -998,7 +1006,7 @@ bool DistributedWantParams::ReadFromParcelBool(Parcel& parcel, const std::string
|
||||
{
|
||||
int8_t value;
|
||||
if (parcel.ReadInt8(value)) {
|
||||
sptr<IInterface> intf = Boolean::Box(value);
|
||||
sptr<IInterface> intf = AAFwk::Boolean::Box(value);
|
||||
if (intf) {
|
||||
SetParam(key, intf);
|
||||
}
|
||||
@ -1012,7 +1020,7 @@ bool DistributedWantParams::ReadFromParcelInt8(Parcel& parcel, const std::string
|
||||
{
|
||||
int8_t value;
|
||||
if (parcel.ReadInt8(value)) {
|
||||
sptr<IInterface> intf = Byte::Box(value);
|
||||
sptr<IInterface> intf = AAFwk::Byte::Box(value);
|
||||
if (intf) {
|
||||
SetParam(key, intf);
|
||||
}
|
||||
@ -1026,7 +1034,7 @@ bool DistributedWantParams::ReadFromParcelChar(Parcel& parcel, const std::string
|
||||
{
|
||||
int32_t value;
|
||||
if (parcel.ReadInt32(value)) {
|
||||
sptr<IInterface> intf = Char::Box(value);
|
||||
sptr<IInterface> intf = AAFwk::Char::Box(value);
|
||||
if (intf) {
|
||||
SetParam(key, intf);
|
||||
}
|
||||
@ -1040,7 +1048,7 @@ bool DistributedWantParams::ReadFromParcelShort(Parcel& parcel, const std::strin
|
||||
{
|
||||
short value;
|
||||
if (parcel.ReadInt16(value)) {
|
||||
sptr<IInterface> intf = Short::Box(value);
|
||||
sptr<IInterface> intf = AAFwk::Short::Box(value);
|
||||
if (intf) {
|
||||
SetParam(key, intf);
|
||||
}
|
||||
@ -1054,7 +1062,7 @@ bool DistributedWantParams::ReadFromParcelInt(Parcel& parcel, const std::string&
|
||||
{
|
||||
int value;
|
||||
if (parcel.ReadInt32(value)) {
|
||||
sptr<IInterface> intf = Integer::Box(value);
|
||||
sptr<IInterface> intf = AAFwk::Integer::Box(value);
|
||||
if (intf) {
|
||||
SetParam(key, intf);
|
||||
}
|
||||
@ -1080,7 +1088,7 @@ bool DistributedWantParams::ReadFromParcelLong(Parcel& parcel, const std::string
|
||||
#ifdef WANT_PARAM_USE_LONG
|
||||
sptr<IInterface> intf = Long::Box(value);
|
||||
#else
|
||||
sptr<IInterface> intf = String::Box(std::to_string(value));
|
||||
sptr<IInterface> intf = AAFwk::String::Box(std::to_string(value));
|
||||
#endif
|
||||
if (intf) {
|
||||
SetParam(key, intf);
|
||||
@ -1095,7 +1103,7 @@ bool DistributedWantParams::ReadFromParcelFloat(Parcel& parcel, const std::strin
|
||||
{
|
||||
float value;
|
||||
if (parcel.ReadFloat(value)) {
|
||||
sptr<IInterface> intf = Float::Box(value);
|
||||
sptr<IInterface> intf = AAFwk::Float::Box(value);
|
||||
if (intf) {
|
||||
SetParam(key, intf);
|
||||
}
|
||||
@ -1109,7 +1117,7 @@ bool DistributedWantParams::ReadFromParcelDouble(Parcel& parcel, const std::stri
|
||||
{
|
||||
double value;
|
||||
if (parcel.ReadDouble(value)) {
|
||||
sptr<IInterface> intf = Double::Box(value);
|
||||
sptr<IInterface> intf = AAFwk::Double::Box(value);
|
||||
if (intf) {
|
||||
SetParam(key, intf);
|
||||
}
|
||||
@ -1189,7 +1197,7 @@ bool DistributedWantParams::ReadFromParcelParam(Parcel& parcel, const std::strin
|
||||
}
|
||||
break;
|
||||
default: {
|
||||
sptr<IArray> ao = nullptr;
|
||||
sptr<AAFwk::IArray> ao = nullptr;
|
||||
if (!ReadArrayToParcel(parcel, type, ao)) {
|
||||
return false;
|
||||
}
|
||||
@ -1257,13 +1265,13 @@ DistributedWantParams* DistributedWantParams::Unmarshalling(Parcel& parcel)
|
||||
return wantParams;
|
||||
}
|
||||
|
||||
WantParams DistributedWantParams::ToWantParams() {
|
||||
WantParams wantParams;
|
||||
AAFwk::WantParams DistributedWantParams::ToWantParams() {
|
||||
AAFwk::WantParams wantParams;
|
||||
std::map<std::string, sptr<IInterface>> data = GetParams();
|
||||
for (auto it = data.begin(); it != data.end(); it++) {
|
||||
wantParams.SetParam(it->first, it->second);
|
||||
}
|
||||
return wantParams;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
@ -14,10 +14,11 @@
|
||||
*/
|
||||
|
||||
#include <algorithm>
|
||||
#include "distributedWant/distributed_want_params_wrapper.h"
|
||||
#include "distributed_want_params_wrapper.h"
|
||||
|
||||
using namespace OHOS::AAFwk;
|
||||
namespace OHOS {
|
||||
namespace AAFwk {
|
||||
namespace DistributedSchedule {
|
||||
constexpr int32_t DISTRIBUTEDWANT_PARAM_WRAPPER_TWO = 2;
|
||||
|
||||
IINTERFACE_IMPL_1(DistributedWantParamWrapper, Object, IDistributedWantParams);
|
||||
@ -213,5 +214,5 @@ DistributedWantParams DistributedWantParamWrapper::ParseWantParams(const std::st
|
||||
}
|
||||
return wantPaqrams;
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace DistributedSchedule
|
||||
} // namespace OHOS
|
@ -14,9 +14,8 @@
|
||||
*/
|
||||
|
||||
#include "distributed_sched_proxy.h"
|
||||
|
||||
#include "dfx/dms_hitrace_constants.h"
|
||||
#include "distributedWant/distributed_want.h"
|
||||
#include "distributed_want.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "ipc_types.h"
|
||||
#ifdef SUPPORT_DISTRIBUTED_MISSION_MANAGER
|
||||
@ -755,7 +754,7 @@ int32_t DistributedSchedProxy::StartFreeInstallFromRemote(const FreeInstallInfo&
|
||||
PARCEL_WRITE_HELPER(data, StringVector, info.accountInfo.groupIdList);
|
||||
PARCEL_WRITE_HELPER(data, String, info.callerInfo.callerAppId);
|
||||
PARCEL_WRITE_HELPER(data, Int64, taskId);
|
||||
OHOS::AAFwk::DistributedWant cmpWant;
|
||||
DistributedWant cmpWant;
|
||||
cmpWant.SetParam(CMPT_PARAM_FREEINSTALL_BUNDLENAMES, info.callerInfo.bundleNames);
|
||||
PARCEL_WRITE_HELPER(data, Parcelable, &cmpWant);
|
||||
nlohmann::json extraInfoJson;
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "dfx/dms_hisysevent_report.h"
|
||||
#include "dfx/dms_hitrace_chain.h"
|
||||
#include "dfx/dms_hitrace_constants.h"
|
||||
#include "distributedWant/distributed_want.h"
|
||||
#include "distributed_want.h"
|
||||
#include "distributed_sched_permission.h"
|
||||
#include "dtbschedmgr_log.h"
|
||||
#include "dtbschedmgr_device_info_storage.h"
|
||||
@ -215,7 +215,7 @@ int32_t DistributedSchedStub::StartAbilityFromRemoteInner(MessageParcel& data, M
|
||||
return DMS_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
shared_ptr<AAFwk::DistributedWant> dstbWant(data.ReadParcelable<AAFwk::DistributedWant>());
|
||||
shared_ptr<DistributedWant> dstbWant(data.ReadParcelable<DistributedWant>());
|
||||
shared_ptr<AAFwk::Want> want = nullptr;
|
||||
if (dstbWant != nullptr) {
|
||||
want = dstbWant->ToWant();
|
||||
@ -285,7 +285,7 @@ int32_t DistributedSchedStub::SendResultFromRemoteInner(MessageParcel& data, Mes
|
||||
HILOGW("request DENIED!");
|
||||
return DMS_PERMISSION_DENIED;
|
||||
}
|
||||
shared_ptr<AAFwk::DistributedWant> dstbWant(data.ReadParcelable<AAFwk::DistributedWant>());
|
||||
shared_ptr<DistributedWant> dstbWant(data.ReadParcelable<DistributedWant>());
|
||||
shared_ptr<AAFwk::Want> want = nullptr;
|
||||
if (dstbWant != nullptr) {
|
||||
want = dstbWant->ToWant();
|
||||
@ -480,7 +480,7 @@ int32_t DistributedSchedStub::ConnectAbilityFromRemoteInner(MessageParcel& data,
|
||||
return DMS_PERMISSION_DENIED;
|
||||
}
|
||||
|
||||
shared_ptr<AAFwk::DistributedWant> dstbWant(data.ReadParcelable<AAFwk::DistributedWant>());
|
||||
shared_ptr<DistributedWant> dstbWant(data.ReadParcelable<DistributedWant>());
|
||||
shared_ptr<AAFwk::Want> want = nullptr;
|
||||
if (dstbWant != nullptr) {
|
||||
want = dstbWant->ToWant();
|
||||
@ -883,7 +883,7 @@ int32_t DistributedSchedStub::StartAbilityByCallFromRemoteInner(MessageParcel& d
|
||||
SaveExtraInfo(extraInfoJson, callerInfo);
|
||||
HILOGD("parse extra info");
|
||||
}
|
||||
shared_ptr<AAFwk::DistributedWant> dstbWant(data.ReadParcelable<AAFwk::DistributedWant>());
|
||||
shared_ptr<DistributedWant> dstbWant(data.ReadParcelable<DistributedWant>());
|
||||
shared_ptr<AAFwk::Want> want = nullptr;
|
||||
if (dstbWant != nullptr) {
|
||||
want = dstbWant->ToWant();
|
||||
@ -1046,7 +1046,7 @@ int32_t DistributedSchedStub::StartFreeInstallFromRemoteInner(MessageParcel& dat
|
||||
HILOGW("request DENIED!");
|
||||
return DMS_PERMISSION_DENIED;
|
||||
}
|
||||
shared_ptr<AAFwk::DistributedWant> dstbWant(data.ReadParcelable<AAFwk::DistributedWant>());
|
||||
shared_ptr<DistributedWant> dstbWant(data.ReadParcelable<DistributedWant>());
|
||||
shared_ptr<AAFwk::Want> want = nullptr;
|
||||
if (dstbWant != nullptr) {
|
||||
want = dstbWant->ToWant();
|
||||
@ -1068,7 +1068,7 @@ int32_t DistributedSchedStub::StartFreeInstallFromRemoteInner(MessageParcel& dat
|
||||
PARCEL_READ_HELPER(data, StringVector, &accountInfo.groupIdList);
|
||||
callerInfo.callerAppId = data.ReadString();
|
||||
PARCEL_READ_HELPER(data, Int64, taskId);
|
||||
shared_ptr<AAFwk::DistributedWant> cmpDstbWant(data.ReadParcelable<AAFwk::DistributedWant>());
|
||||
shared_ptr<DistributedWant> cmpDstbWant(data.ReadParcelable<DistributedWant>());
|
||||
shared_ptr<AAFwk::Want> cmpWant = nullptr;
|
||||
if (cmpDstbWant != nullptr) {
|
||||
cmpWant = cmpDstbWant->ToWant();
|
||||
@ -1150,7 +1150,7 @@ int32_t DistributedSchedStub::StopExtensionAbilityFromRemoteInner(MessageParcel&
|
||||
HILOGW("request DENIED!");
|
||||
return DMS_PERMISSION_DENIED;
|
||||
}
|
||||
shared_ptr<AAFwk::DistributedWant> dstbWant(data.ReadParcelable<AAFwk::DistributedWant>());
|
||||
shared_ptr<DistributedWant> dstbWant(data.ReadParcelable<DistributedWant>());
|
||||
shared_ptr<AAFwk::Want> want = nullptr;
|
||||
if (dstbWant != nullptr) {
|
||||
want = dstbWant->ToWant();
|
||||
|
Loading…
Reference in New Issue
Block a user