1e0857b17Sopenharmony_ci/* 2e0857b17Sopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3e0857b17Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4e0857b17Sopenharmony_ci * you may not use this file except in compliance with the License. 5e0857b17Sopenharmony_ci * You may obtain a copy of the License at 6e0857b17Sopenharmony_ci * 7e0857b17Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8e0857b17Sopenharmony_ci * 9e0857b17Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10e0857b17Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11e0857b17Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12e0857b17Sopenharmony_ci * See the License for the specific language governing permissions and 13e0857b17Sopenharmony_ci * limitations under the License. 14e0857b17Sopenharmony_ci */ 15e0857b17Sopenharmony_ci 16e0857b17Sopenharmony_ci#ifndef OHOS_ABILITY_BASE_SKILLS_H 17e0857b17Sopenharmony_ci#define OHOS_ABILITY_BASE_SKILLS_H 18e0857b17Sopenharmony_ci 19e0857b17Sopenharmony_ci#include <vector> 20e0857b17Sopenharmony_ci#include <string> 21e0857b17Sopenharmony_ci#include "want.h" 22e0857b17Sopenharmony_ci#include "want_params.h" 23e0857b17Sopenharmony_ci#include "parcel.h" 24e0857b17Sopenharmony_ci#include "parcel_macro_base.h" 25e0857b17Sopenharmony_ci#include "match_type.h" 26e0857b17Sopenharmony_ci#include "patterns_matcher.h" 27e0857b17Sopenharmony_ci#include "uri.h" 28e0857b17Sopenharmony_ci 29e0857b17Sopenharmony_cinamespace OHOS { 30e0857b17Sopenharmony_cinamespace AAFwk { 31e0857b17Sopenharmony_ciclass Skills final : public Parcelable { 32e0857b17Sopenharmony_cipublic: 33e0857b17Sopenharmony_ci /** 34e0857b17Sopenharmony_ci * @brief Default constructor used to create a Skills instance. 35e0857b17Sopenharmony_ci * 36e0857b17Sopenharmony_ci */ 37e0857b17Sopenharmony_ci Skills(); 38e0857b17Sopenharmony_ci 39e0857b17Sopenharmony_ci /** 40e0857b17Sopenharmony_ci * @brief A parameterized constructor used to create a Skills instance. 41e0857b17Sopenharmony_ci * 42e0857b17Sopenharmony_ci * @param skills Indicates skills used to create a Skills instance. 43e0857b17Sopenharmony_ci */ 44e0857b17Sopenharmony_ci Skills(const Skills &skills); 45e0857b17Sopenharmony_ci ~Skills(); 46e0857b17Sopenharmony_ci 47e0857b17Sopenharmony_ci /** 48e0857b17Sopenharmony_ci * @brief Obtains the list of entities. 49e0857b17Sopenharmony_ci * 50e0857b17Sopenharmony_ci * @return vector of Entities. 51e0857b17Sopenharmony_ci */ 52e0857b17Sopenharmony_ci std::vector<std::string> GetEntities() const; 53e0857b17Sopenharmony_ci 54e0857b17Sopenharmony_ci /** 55e0857b17Sopenharmony_ci * @brief Obtains the specified entity. 56e0857b17Sopenharmony_ci * 57e0857b17Sopenharmony_ci * @param entity Id of the specified entity. 58e0857b17Sopenharmony_ci */ 59e0857b17Sopenharmony_ci std::string GetEntity(int index) const; 60e0857b17Sopenharmony_ci 61e0857b17Sopenharmony_ci /** 62e0857b17Sopenharmony_ci * @brief Adds an entity to this Skills object. 63e0857b17Sopenharmony_ci * 64e0857b17Sopenharmony_ci * @param entity Indicates the entity to add. 65e0857b17Sopenharmony_ci */ 66e0857b17Sopenharmony_ci void AddEntity(const std::string &entity); 67e0857b17Sopenharmony_ci 68e0857b17Sopenharmony_ci /** 69e0857b17Sopenharmony_ci * @brief Checks whether the specified entity is exist. 70e0857b17Sopenharmony_ci * 71e0857b17Sopenharmony_ci * @param entity Name of the specified entity. 72e0857b17Sopenharmony_ci */ 73e0857b17Sopenharmony_ci bool HasEntity(const std::string &entity); 74e0857b17Sopenharmony_ci 75e0857b17Sopenharmony_ci /** 76e0857b17Sopenharmony_ci * @brief Remove the specified entity. 77e0857b17Sopenharmony_ci * 78e0857b17Sopenharmony_ci * @param entity Name of the specified entity. 79e0857b17Sopenharmony_ci */ 80e0857b17Sopenharmony_ci void RemoveEntity(const std::string &entity); 81e0857b17Sopenharmony_ci 82e0857b17Sopenharmony_ci /** 83e0857b17Sopenharmony_ci * @brief Obtains the count of entities. 84e0857b17Sopenharmony_ci * 85e0857b17Sopenharmony_ci */ 86e0857b17Sopenharmony_ci int CountEntities() const; 87e0857b17Sopenharmony_ci 88e0857b17Sopenharmony_ci /** 89e0857b17Sopenharmony_ci * @brief Obtains the specified action. 90e0857b17Sopenharmony_ci * 91e0857b17Sopenharmony_ci * @param actionId Id of the specified action. 92e0857b17Sopenharmony_ci */ 93e0857b17Sopenharmony_ci std::string GetAction(int index) const; 94e0857b17Sopenharmony_ci 95e0857b17Sopenharmony_ci /** 96e0857b17Sopenharmony_ci * @brief Adds an action to this Skills object. 97e0857b17Sopenharmony_ci * 98e0857b17Sopenharmony_ci * @param action Indicates the action to add. 99e0857b17Sopenharmony_ci */ 100e0857b17Sopenharmony_ci void AddAction(const std::string &action); 101e0857b17Sopenharmony_ci 102e0857b17Sopenharmony_ci /** 103e0857b17Sopenharmony_ci * @brief Checks whether the specified action is exist. 104e0857b17Sopenharmony_ci * 105e0857b17Sopenharmony_ci * @param action Name of the specified action. 106e0857b17Sopenharmony_ci */ 107e0857b17Sopenharmony_ci bool HasAction(const std::string &action); 108e0857b17Sopenharmony_ci 109e0857b17Sopenharmony_ci /** 110e0857b17Sopenharmony_ci * @brief Remove the specified action. 111e0857b17Sopenharmony_ci * 112e0857b17Sopenharmony_ci * @param action Name of the specified action. 113e0857b17Sopenharmony_ci */ 114e0857b17Sopenharmony_ci void RemoveAction(const std::string &action); 115e0857b17Sopenharmony_ci 116e0857b17Sopenharmony_ci /** 117e0857b17Sopenharmony_ci * @brief Obtains the count of actions. 118e0857b17Sopenharmony_ci * 119e0857b17Sopenharmony_ci */ 120e0857b17Sopenharmony_ci int CountActions() const; 121e0857b17Sopenharmony_ci 122e0857b17Sopenharmony_ci /** 123e0857b17Sopenharmony_ci * @brief Obtains the iterator of Actions. 124e0857b17Sopenharmony_ci * 125e0857b17Sopenharmony_ci * @return iterator of Actions. 126e0857b17Sopenharmony_ci */ 127e0857b17Sopenharmony_ci std::vector<std::string>::iterator ActionsIterator(); 128e0857b17Sopenharmony_ci 129e0857b17Sopenharmony_ci /** 130e0857b17Sopenharmony_ci * @brief Obtains the iterator of Authorities. 131e0857b17Sopenharmony_ci * 132e0857b17Sopenharmony_ci * @return iterator of Authorities. 133e0857b17Sopenharmony_ci */ 134e0857b17Sopenharmony_ci std::vector<std::string>::iterator AuthoritiesIterator(); 135e0857b17Sopenharmony_ci 136e0857b17Sopenharmony_ci /** 137e0857b17Sopenharmony_ci * @brief Obtains the iterator of Entities. 138e0857b17Sopenharmony_ci * 139e0857b17Sopenharmony_ci * @return iterator of Entities. 140e0857b17Sopenharmony_ci */ 141e0857b17Sopenharmony_ci std::vector<std::string>::iterator EntitiesIterator(); 142e0857b17Sopenharmony_ci 143e0857b17Sopenharmony_ci /** 144e0857b17Sopenharmony_ci * @brief Obtains the iterator of Paths. 145e0857b17Sopenharmony_ci * 146e0857b17Sopenharmony_ci * @return iterator of Paths. 147e0857b17Sopenharmony_ci */ 148e0857b17Sopenharmony_ci std::vector<std::string>::iterator PathsIterator(); 149e0857b17Sopenharmony_ci 150e0857b17Sopenharmony_ci /** 151e0857b17Sopenharmony_ci * @brief Obtains the iterator of Schemes parts. 152e0857b17Sopenharmony_ci * 153e0857b17Sopenharmony_ci * @return iterator of Schemes parts. 154e0857b17Sopenharmony_ci */ 155e0857b17Sopenharmony_ci std::vector<std::string>::iterator SchemeSpecificPartsIterator(); 156e0857b17Sopenharmony_ci 157e0857b17Sopenharmony_ci /** 158e0857b17Sopenharmony_ci * @brief Obtains the iterator of Schemes. 159e0857b17Sopenharmony_ci * 160e0857b17Sopenharmony_ci * @return iterator of Schemes. 161e0857b17Sopenharmony_ci */ 162e0857b17Sopenharmony_ci std::vector<std::string>::iterator SchemesIterator(); 163e0857b17Sopenharmony_ci 164e0857b17Sopenharmony_ci /** 165e0857b17Sopenharmony_ci * @brief Obtains the iterator of Types. 166e0857b17Sopenharmony_ci * 167e0857b17Sopenharmony_ci * @return iterator of Types. 168e0857b17Sopenharmony_ci */ 169e0857b17Sopenharmony_ci std::vector<std::string>::iterator TypesIterator(); 170e0857b17Sopenharmony_ci 171e0857b17Sopenharmony_ci /** 172e0857b17Sopenharmony_ci * @brief Obtains the specified authority. 173e0857b17Sopenharmony_ci * 174e0857b17Sopenharmony_ci * @param authorityId Id of the specified authority. 175e0857b17Sopenharmony_ci */ 176e0857b17Sopenharmony_ci std::string GetAuthority(int index) const; 177e0857b17Sopenharmony_ci 178e0857b17Sopenharmony_ci /** 179e0857b17Sopenharmony_ci * @brief Adds an authority to this Skills object. 180e0857b17Sopenharmony_ci * 181e0857b17Sopenharmony_ci * @param authority Indicates the authority to add. 182e0857b17Sopenharmony_ci */ 183e0857b17Sopenharmony_ci void AddAuthority(const std::string &authority); 184e0857b17Sopenharmony_ci 185e0857b17Sopenharmony_ci /** 186e0857b17Sopenharmony_ci * @brief Checks whether the specified authority is exist. 187e0857b17Sopenharmony_ci * 188e0857b17Sopenharmony_ci * @param authority Name of the specified authority. 189e0857b17Sopenharmony_ci */ 190e0857b17Sopenharmony_ci bool HasAuthority(const std::string &authority); 191e0857b17Sopenharmony_ci 192e0857b17Sopenharmony_ci /** 193e0857b17Sopenharmony_ci * @brief Remove the specified authority. 194e0857b17Sopenharmony_ci * 195e0857b17Sopenharmony_ci * @param authority Name of the specified authority. 196e0857b17Sopenharmony_ci */ 197e0857b17Sopenharmony_ci void RemoveAuthority(const std::string &authority); 198e0857b17Sopenharmony_ci 199e0857b17Sopenharmony_ci /** 200e0857b17Sopenharmony_ci * @brief Obtains the count of authorities. 201e0857b17Sopenharmony_ci * 202e0857b17Sopenharmony_ci */ 203e0857b17Sopenharmony_ci int CountAuthorities() const; 204e0857b17Sopenharmony_ci 205e0857b17Sopenharmony_ci /** 206e0857b17Sopenharmony_ci * @brief Obtains the specified path. 207e0857b17Sopenharmony_ci * 208e0857b17Sopenharmony_ci * @param pathId Id of the specified path. 209e0857b17Sopenharmony_ci */ 210e0857b17Sopenharmony_ci std::string GetPath(int index) const; 211e0857b17Sopenharmony_ci 212e0857b17Sopenharmony_ci /** 213e0857b17Sopenharmony_ci * @brief Adds a path to this Skills object. 214e0857b17Sopenharmony_ci * 215e0857b17Sopenharmony_ci * @param path Indicates the path to add. 216e0857b17Sopenharmony_ci */ 217e0857b17Sopenharmony_ci void AddPath(const std::string &path); 218e0857b17Sopenharmony_ci 219e0857b17Sopenharmony_ci /** 220e0857b17Sopenharmony_ci * @brief Adds a path to this Skills object. 221e0857b17Sopenharmony_ci * 222e0857b17Sopenharmony_ci * @param path Indicates the path to add. 223e0857b17Sopenharmony_ci */ 224e0857b17Sopenharmony_ci void AddPath(const PatternsMatcher &patternsMatcher); 225e0857b17Sopenharmony_ci 226e0857b17Sopenharmony_ci /** 227e0857b17Sopenharmony_ci * @brief Adds a path to this Skills object. 228e0857b17Sopenharmony_ci * 229e0857b17Sopenharmony_ci * @param path Indicates the path to add. 230e0857b17Sopenharmony_ci * @param matchType the specified match type. 231e0857b17Sopenharmony_ci */ 232e0857b17Sopenharmony_ci void AddPath(const std::string &path, const MatchType &matchType); 233e0857b17Sopenharmony_ci 234e0857b17Sopenharmony_ci /** 235e0857b17Sopenharmony_ci * @brief Checks whether the specified path is exist. 236e0857b17Sopenharmony_ci * 237e0857b17Sopenharmony_ci * @param path Name of the specified path. 238e0857b17Sopenharmony_ci */ 239e0857b17Sopenharmony_ci bool HasPath(const std::string &path); 240e0857b17Sopenharmony_ci 241e0857b17Sopenharmony_ci /** 242e0857b17Sopenharmony_ci * @brief Remove the specified path. 243e0857b17Sopenharmony_ci * 244e0857b17Sopenharmony_ci * @param path Name of the specified path. 245e0857b17Sopenharmony_ci */ 246e0857b17Sopenharmony_ci void RemovePath(const std::string &path); 247e0857b17Sopenharmony_ci 248e0857b17Sopenharmony_ci /** 249e0857b17Sopenharmony_ci * @brief Remove the specified path. 250e0857b17Sopenharmony_ci * 251e0857b17Sopenharmony_ci * @param path The path to be added. 252e0857b17Sopenharmony_ci */ 253e0857b17Sopenharmony_ci void RemovePath(const PatternsMatcher &patternsMatcher); 254e0857b17Sopenharmony_ci 255e0857b17Sopenharmony_ci /** 256e0857b17Sopenharmony_ci * @brief Remove the specified path. 257e0857b17Sopenharmony_ci * 258e0857b17Sopenharmony_ci * @param path Name of the specified path. 259e0857b17Sopenharmony_ci * @param matchType the specified match type. 260e0857b17Sopenharmony_ci */ 261e0857b17Sopenharmony_ci void RemovePath(const std::string &path, const MatchType &matchType); 262e0857b17Sopenharmony_ci 263e0857b17Sopenharmony_ci /** 264e0857b17Sopenharmony_ci * @brief Obtains the count of paths. 265e0857b17Sopenharmony_ci * 266e0857b17Sopenharmony_ci */ 267e0857b17Sopenharmony_ci int CountPaths() const; 268e0857b17Sopenharmony_ci 269e0857b17Sopenharmony_ci /** 270e0857b17Sopenharmony_ci * @brief Obtains the specified scheme. 271e0857b17Sopenharmony_ci * 272e0857b17Sopenharmony_ci * @param schemeId Id of the specified scheme. 273e0857b17Sopenharmony_ci */ 274e0857b17Sopenharmony_ci std::string GetScheme(int index) const; 275e0857b17Sopenharmony_ci 276e0857b17Sopenharmony_ci /** 277e0857b17Sopenharmony_ci * @brief Adds an scheme to this Skills object. 278e0857b17Sopenharmony_ci * 279e0857b17Sopenharmony_ci * @param scheme Indicates the scheme to add. 280e0857b17Sopenharmony_ci */ 281e0857b17Sopenharmony_ci void AddScheme(const std::string &scheme); 282e0857b17Sopenharmony_ci 283e0857b17Sopenharmony_ci /** 284e0857b17Sopenharmony_ci * @brief Checks whether the specified scheme is exist. 285e0857b17Sopenharmony_ci * 286e0857b17Sopenharmony_ci * @param scheme Name of the specified scheme. 287e0857b17Sopenharmony_ci */ 288e0857b17Sopenharmony_ci bool HasScheme(const std::string &scheme); 289e0857b17Sopenharmony_ci 290e0857b17Sopenharmony_ci /** 291e0857b17Sopenharmony_ci * @brief Remove the specified scheme. 292e0857b17Sopenharmony_ci * 293e0857b17Sopenharmony_ci * @param scheme Name of the specified scheme. 294e0857b17Sopenharmony_ci */ 295e0857b17Sopenharmony_ci void RemoveScheme(const std::string &scheme); 296e0857b17Sopenharmony_ci 297e0857b17Sopenharmony_ci /** 298e0857b17Sopenharmony_ci * @brief Obtains the count of schemes. 299e0857b17Sopenharmony_ci * 300e0857b17Sopenharmony_ci */ 301e0857b17Sopenharmony_ci int CountSchemes() const; 302e0857b17Sopenharmony_ci 303e0857b17Sopenharmony_ci /** 304e0857b17Sopenharmony_ci * @brief Obtains the specified scheme part. 305e0857b17Sopenharmony_ci * 306e0857b17Sopenharmony_ci * @param schemeId Id of the specified scheme part. 307e0857b17Sopenharmony_ci */ 308e0857b17Sopenharmony_ci std::string GetSchemeSpecificPart(int index) const; 309e0857b17Sopenharmony_ci 310e0857b17Sopenharmony_ci /** 311e0857b17Sopenharmony_ci * @brief Adds an scheme to this Skills object. 312e0857b17Sopenharmony_ci * 313e0857b17Sopenharmony_ci * @param scheme Indicates the scheme to add. 314e0857b17Sopenharmony_ci */ 315e0857b17Sopenharmony_ci void AddSchemeSpecificPart(const std::string &schemeSpecificPart); 316e0857b17Sopenharmony_ci 317e0857b17Sopenharmony_ci /** 318e0857b17Sopenharmony_ci * @brief Checks whether the specified scheme part is exist. 319e0857b17Sopenharmony_ci * 320e0857b17Sopenharmony_ci * @param scheme Name of the specified scheme part. 321e0857b17Sopenharmony_ci */ 322e0857b17Sopenharmony_ci bool HasSchemeSpecificPart(const std::string &schemeSpecificPart); 323e0857b17Sopenharmony_ci 324e0857b17Sopenharmony_ci /** 325e0857b17Sopenharmony_ci * @brief Remove the specified scheme part. 326e0857b17Sopenharmony_ci * 327e0857b17Sopenharmony_ci * @param scheme Name of the specified scheme part. 328e0857b17Sopenharmony_ci */ 329e0857b17Sopenharmony_ci void RemoveSchemeSpecificPart(const std::string &schemeSpecificPart); 330e0857b17Sopenharmony_ci 331e0857b17Sopenharmony_ci /** 332e0857b17Sopenharmony_ci * @brief Obtains the count of scheme parts. 333e0857b17Sopenharmony_ci * 334e0857b17Sopenharmony_ci */ 335e0857b17Sopenharmony_ci int CountSchemeSpecificParts() const; 336e0857b17Sopenharmony_ci 337e0857b17Sopenharmony_ci /** 338e0857b17Sopenharmony_ci * @brief Obtains the specified type. 339e0857b17Sopenharmony_ci * 340e0857b17Sopenharmony_ci * @param typeId Id of the specified type. 341e0857b17Sopenharmony_ci */ 342e0857b17Sopenharmony_ci std::string GetType(int index) const; 343e0857b17Sopenharmony_ci 344e0857b17Sopenharmony_ci /** 345e0857b17Sopenharmony_ci * @brief Adds a type to this Skills object. 346e0857b17Sopenharmony_ci * 347e0857b17Sopenharmony_ci * @param type Indicates the type to add. 348e0857b17Sopenharmony_ci */ 349e0857b17Sopenharmony_ci void AddType(const std::string &type); 350e0857b17Sopenharmony_ci 351e0857b17Sopenharmony_ci /** 352e0857b17Sopenharmony_ci * @brief Adds a type to this Skills object. 353e0857b17Sopenharmony_ci * 354e0857b17Sopenharmony_ci * @param type Indicates the type to add. 355e0857b17Sopenharmony_ci */ 356e0857b17Sopenharmony_ci void AddType(const PatternsMatcher &patternsMatcher); 357e0857b17Sopenharmony_ci 358e0857b17Sopenharmony_ci /** 359e0857b17Sopenharmony_ci * @brief Adds a type to this Skills object. 360e0857b17Sopenharmony_ci * 361e0857b17Sopenharmony_ci * @param type Indicates the type to add. 362e0857b17Sopenharmony_ci * @param matchType the specified match type. 363e0857b17Sopenharmony_ci */ 364e0857b17Sopenharmony_ci void AddType(const std::string &type, const MatchType &matchType); 365e0857b17Sopenharmony_ci 366e0857b17Sopenharmony_ci /** 367e0857b17Sopenharmony_ci * @brief Checks whether the specified type is exist. 368e0857b17Sopenharmony_ci * 369e0857b17Sopenharmony_ci * @param type Name of the specified type. 370e0857b17Sopenharmony_ci */ 371e0857b17Sopenharmony_ci bool HasType(const std::string &type); 372e0857b17Sopenharmony_ci 373e0857b17Sopenharmony_ci /** 374e0857b17Sopenharmony_ci * @brief Remove the specified type. 375e0857b17Sopenharmony_ci * 376e0857b17Sopenharmony_ci * @param type Name of the specified type. 377e0857b17Sopenharmony_ci */ 378e0857b17Sopenharmony_ci void RemoveType(const std::string &type); 379e0857b17Sopenharmony_ci 380e0857b17Sopenharmony_ci /** 381e0857b17Sopenharmony_ci * @brief Remove the specified scheme type. 382e0857b17Sopenharmony_ci * 383e0857b17Sopenharmony_ci * @param type The type to be added. 384e0857b17Sopenharmony_ci */ 385e0857b17Sopenharmony_ci void RemoveType(const PatternsMatcher &patternsMatcher); 386e0857b17Sopenharmony_ci 387e0857b17Sopenharmony_ci /** 388e0857b17Sopenharmony_ci * @brief Remove the specified scheme type. 389e0857b17Sopenharmony_ci * 390e0857b17Sopenharmony_ci * @param type Name of the specified type. 391e0857b17Sopenharmony_ci * @param matchType the specified match type. 392e0857b17Sopenharmony_ci */ 393e0857b17Sopenharmony_ci void RemoveType(const std::string &type, const MatchType &matchType); 394e0857b17Sopenharmony_ci 395e0857b17Sopenharmony_ci /** 396e0857b17Sopenharmony_ci * @brief Obtains the count of types. 397e0857b17Sopenharmony_ci * 398e0857b17Sopenharmony_ci */ 399e0857b17Sopenharmony_ci int CountTypes() const; 400e0857b17Sopenharmony_ci 401e0857b17Sopenharmony_ci /** 402e0857b17Sopenharmony_ci * @brief Match this skill against a Want's data. 403e0857b17Sopenharmony_ci * 404e0857b17Sopenharmony_ci * @param want The desired want data to match for. 405e0857b17Sopenharmony_ci */ 406e0857b17Sopenharmony_ci bool Match(const Want &want); 407e0857b17Sopenharmony_ci 408e0857b17Sopenharmony_ci /** 409e0857b17Sopenharmony_ci * @brief Obtains the want params data. 410e0857b17Sopenharmony_ci * 411e0857b17Sopenharmony_ci * @return the WantParams object. 412e0857b17Sopenharmony_ci */ 413e0857b17Sopenharmony_ci const WantParams &GetWantParams() const; 414e0857b17Sopenharmony_ci 415e0857b17Sopenharmony_ci /** 416e0857b17Sopenharmony_ci * @brief Sets a WantParams object in this MatchingSkills object. 417e0857b17Sopenharmony_ci * 418e0857b17Sopenharmony_ci * @param wantParams Indicates the WantParams object. 419e0857b17Sopenharmony_ci */ 420e0857b17Sopenharmony_ci void SetWantParams(const WantParams &wantParams); 421e0857b17Sopenharmony_ci 422e0857b17Sopenharmony_ci /** 423e0857b17Sopenharmony_ci * @brief Marshals this Sequenceable object into a Parcel. 424e0857b17Sopenharmony_ci * 425e0857b17Sopenharmony_ci * @param outParcel Indicates the Parcel object to which the Sequenceable object will be marshaled. 426e0857b17Sopenharmony_ci */ 427e0857b17Sopenharmony_ci bool Marshalling(Parcel &parcel) const; 428e0857b17Sopenharmony_ci 429e0857b17Sopenharmony_ci /** 430e0857b17Sopenharmony_ci * @brief Unmarshals this Sequenceable object from a Parcel. 431e0857b17Sopenharmony_ci * 432e0857b17Sopenharmony_ci * @param inParcel Indicates the Parcel object into which the Sequenceable object has been marshaled. 433e0857b17Sopenharmony_ci */ 434e0857b17Sopenharmony_ci static Skills *Unmarshalling(Parcel &parcel); 435e0857b17Sopenharmony_ci 436e0857b17Sopenharmony_ciprivate: 437e0857b17Sopenharmony_ci static const int DISMATCH_TYPE = -101; 438e0857b17Sopenharmony_ci static const int DISMATCH_DATA = -102; 439e0857b17Sopenharmony_ci static const int DISMATCH_ACTION = -103; 440e0857b17Sopenharmony_ci static const int DISMATCH_ENTITIES = -104; 441e0857b17Sopenharmony_ci 442e0857b17Sopenharmony_ci static const int RESULT_EMPTY = 0x10000; 443e0857b17Sopenharmony_ci static const int RESULT_SCHEME = 0x20000; 444e0857b17Sopenharmony_ci static const int RESULT_PATH = 0x50000; 445e0857b17Sopenharmony_ci static const int RESULT_SCHEME_SPECIFIC_PART = 0x58000; 446e0857b17Sopenharmony_ci static const int RESULT_TYPE = 0x60000; 447e0857b17Sopenharmony_ci static const int RESULT_NORMAL = 0x800; 448e0857b17Sopenharmony_ci 449e0857b17Sopenharmony_ci std::vector<std::string> entities_; 450e0857b17Sopenharmony_ci std::vector<std::string> actions_; 451e0857b17Sopenharmony_ci std::vector<std::string> authorities_; 452e0857b17Sopenharmony_ci std::vector<std::string> schemes_; 453e0857b17Sopenharmony_ci 454e0857b17Sopenharmony_ci std::vector<PatternsMatcher> paths_; 455e0857b17Sopenharmony_ci std::vector<PatternsMatcher> schemeSpecificParts_; 456e0857b17Sopenharmony_ci std::vector<PatternsMatcher> types_; 457e0857b17Sopenharmony_ci 458e0857b17Sopenharmony_ci WantParams wantParams_; 459e0857b17Sopenharmony_ci bool hasPartialTypes_ = false; 460e0857b17Sopenharmony_ci 461e0857b17Sopenharmony_ci // no object in parcel 462e0857b17Sopenharmony_ci static constexpr int VALUE_NULL = -1; 463e0857b17Sopenharmony_ci // object exist in parcel 464e0857b17Sopenharmony_ci static constexpr int VALUE_OBJECT = 1; 465e0857b17Sopenharmony_ci 466e0857b17Sopenharmony_ciprivate: 467e0857b17Sopenharmony_ci bool ReadFromParcel(Parcel &parcel); 468e0857b17Sopenharmony_ci 469e0857b17Sopenharmony_ci /** 470e0857b17Sopenharmony_ci * @brief Match this skills against a Want's action. If the skills does not 471e0857b17Sopenharmony_ci * specify any actions, the match will always fail. 472e0857b17Sopenharmony_ci * 473e0857b17Sopenharmony_ci * @param action The desired action to look for. 474e0857b17Sopenharmony_ci * 475e0857b17Sopenharmony_ci * @return True if the action is listed in the skills. 476e0857b17Sopenharmony_ci */ 477e0857b17Sopenharmony_ci bool MatchAction(const std::string &action); 478e0857b17Sopenharmony_ci 479e0857b17Sopenharmony_ci /** 480e0857b17Sopenharmony_ci * @brief Match this skills against a Want's data (type, scheme and path). 481e0857b17Sopenharmony_ci * 482e0857b17Sopenharmony_ci * @param type The desired data type to look for. 483e0857b17Sopenharmony_ci * @param scheme The desired data scheme to look for. 484e0857b17Sopenharmony_ci * @param data The full data string to match against. 485e0857b17Sopenharmony_ci * 486e0857b17Sopenharmony_ci * @return Returns either a valid match constant. 487e0857b17Sopenharmony_ci */ 488e0857b17Sopenharmony_ci int MatchData(const std::string &type, const std::string &scheme, Uri data); 489e0857b17Sopenharmony_ci 490e0857b17Sopenharmony_ci bool FindMimeType(const std::string &type); 491e0857b17Sopenharmony_ci 492e0857b17Sopenharmony_ci bool RegionMatches(const std::string &type, int toffset, const std::string &other, int ooffset, int len); 493e0857b17Sopenharmony_ci 494e0857b17Sopenharmony_ci /** 495e0857b17Sopenharmony_ci * @brief Match this skills against a Want's entities. Each entity in 496e0857b17Sopenharmony_ci * the Want must be specified by the skills; if any are not in the 497e0857b17Sopenharmony_ci * skills, the match fails. 498e0857b17Sopenharmony_ci * 499e0857b17Sopenharmony_ci * @param entities The entities included in the want, as returned by 500e0857b17Sopenharmony_ci * Want.getEntities(). 501e0857b17Sopenharmony_ci * 502e0857b17Sopenharmony_ci * @return If all entities match (success), null; else the name of the 503e0857b17Sopenharmony_ci * first entity that didn't match. 504e0857b17Sopenharmony_ci */ 505e0857b17Sopenharmony_ci std::string MatchEntities(const std::vector<std::string> &entities); 506e0857b17Sopenharmony_ci}; 507e0857b17Sopenharmony_ci} // namespace AAFwk 508e0857b17Sopenharmony_ci} // namespace OHOS 509e0857b17Sopenharmony_ci 510e0857b17Sopenharmony_ci#endif // OHOS_ABILITY_BASE_SKILLS_H 511