1 /* 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef OHOS_RESOURCE_MANAGER_RESOURCEMANAGERIMPL_H 16 #define OHOS_RESOURCE_MANAGER_RESOURCEMANAGERIMPL_H 17 18 #include <map> 19 #include <string> 20 #include <vector> 21 #include "hap_manager.h" 22 #include "resource_manager.h" 23 #include "utils/psue_manager.h" 24 #include "theme_pack_manager.h" 25 26 namespace OHOS { 27 namespace Global { 28 namespace Resource { 29 class ResourceManagerImpl : public ResourceManager { 30 public: 31 ResourceManagerImpl(); 32 33 ~ResourceManagerImpl(); 34 35 /** 36 * Init resource manager. 37 * 38 * @param isSystem indicate the resource manager is system or not. 39 * @return true if init success, else false 40 */ 41 bool Init(bool isSystem = false); 42 43 /** 44 * Add system resource to hap resource vector. 45 * 46 * @param systemResourceManager the system resource manager. 47 */ 48 void AddSystemResource(ResourceManagerImpl *systemResourceManager); 49 50 /** 51 * Add resource path to hap paths 52 * @param path the resource path 53 * @return true if add resource path success, else false 54 */ 55 virtual bool AddResource(const char *path); 56 57 /** 58 * Add resource path to overlay paths 59 * @param path the resource path 60 * @param overlayPaths the exist overlay resource path 61 * @return true if add resource path success, else false 62 */ 63 virtual bool AddResource(const std::string &path, const std::vector<std::string> &overlayPaths); 64 65 /** 66 * Remove resource path to overlay paths 67 * @param path the resource path 68 * @param overlayPaths the exist overlay resource path 69 * @return true if add resource path success, else false 70 */ 71 virtual bool RemoveResource(const std::string &path, const std::vector<std::string> &overlayPaths); 72 73 /** 74 * Add the overlay resource for current application 75 * 76 * @param path the overlay resource path 77 * @return true if add resource path success, else false 78 */ 79 virtual bool AddAppOverlay(const std::string &path); 80 81 /** 82 * Remove the overlay resource for current application 83 * 84 * @param path the overlay resource path 85 * @return true if add resource path success, else false 86 */ 87 virtual bool RemoveAppOverlay(const std::string &path); 88 89 /** 90 * Update the resConfig 91 * @param resConfig the resource config 92 * @return SUCCESS if the resConfig updated success, else HAP_INIT_FAILED 93 */ 94 virtual RState UpdateResConfig(ResConfig &resConfig, bool isUpdateTheme = false); 95 96 /** 97 * Get the resConfig 98 * @param resConfig the resource config 99 */ 100 virtual void GetResConfig(ResConfig &resConfig); 101 102 /** 103 * Get string resource by Id 104 * @param id the resource Id 105 * @param outValue the string resource write to 106 * @return SUCCESS if resource exist, else NOT_FOUND 107 */ 108 virtual RState GetStringById(uint32_t id, std::string &outValue); 109 110 /** 111 * Get string by resource name 112 * @param name the resource name 113 * @param outValue the resource write to 114 * @return SUCCESS if resource exist, else NOT_FOUND 115 */ 116 virtual RState GetStringByName(const char *name, std::string &outValue); 117 118 /** 119 * Get string format by resource id 120 * @param id the resource id 121 * @param outValue the resource write to 122 * @return SUCCESS if resource exist, else NOT_FOUND 123 */ 124 virtual RState GetStringFormatById(std::string &outValue, uint32_t id, ...); 125 126 /** 127 * Get string format by resource name 128 * @param name the resource name 129 * @param outValue the resource write to 130 * @return SUCCESS if resource exist, else NOT_FOUND 131 */ 132 virtual RState GetStringFormatByName(std::string &outValue, const char *name, ...); 133 134 /** 135 * Get the STRINGARRAY resource by resource id 136 * @param id the resource id 137 * @param outValue the resource write to 138 * @return SUCCESS if resource exist, else NOT_FOUND 139 */ 140 virtual RState GetStringArrayById(uint32_t id, std::vector<std::string> &outValue); 141 142 /** 143 * Get the STRINGARRAY resource by resource name 144 * @param name the resource name 145 * @param outValue the resource write to 146 * @return SUCCESS if resource exist, else NOT_FOUND 147 */ 148 virtual RState GetStringArrayByName(const char *name, std::vector<std::string> &outValue); 149 150 /** 151 * Get the PATTERN resource by resource id 152 * @param id the resource id 153 * @param outValue the resource write to 154 * @return SUCCESS if resource exist, else NOT_FOUND 155 */ 156 virtual RState GetPatternById(uint32_t id, std::map<std::string, std::string> &outValue); 157 158 /** 159 * Get the PATTERN resource by resource name 160 * @param name the resource name 161 * @param outValue the resource write to 162 * @return SUCCESS if resource exist, else NOT_FOUND 163 */ 164 virtual RState GetPatternByName(const char *name, std::map<std::string, std::string> &outValue); 165 166 /** 167 * Get the plural string by resource id 168 * @param id the resource id 169 * @param quantity the language quantity 170 * @param outValue the resource write to 171 * @return SUCCESS if resource exist, else NOT_FOUND 172 */ 173 virtual RState GetPluralStringById(uint32_t id, int quantity, std::string &outValue); 174 175 /** 176 * Get the plural string by resource name 177 * @param name the resource name 178 * @param quantity the language quantity 179 * @param outValue the resource write to 180 * @return SUCCESS if resource exist, else NOT_FOUND 181 */ 182 virtual RState GetPluralStringByName(const char *name, int quantity, std::string &outValue); 183 184 /** 185 * Get the plural format string by resource id 186 * @param outValue the resource write to 187 * @param id the resource id 188 * @param quantity the language quantity 189 * @return SUCCESS if resource exist, else NOT_FOUND 190 */ 191 virtual RState GetPluralStringByIdFormat(std::string &outValue, uint32_t id, int quantity, ...); 192 193 /** 194 * Get the plural format string by resource name 195 * @param outValue the resource write to 196 * @param id the resource id 197 * @param quantity the language quantity 198 * @return SUCCESS if resource exist, else NOT_FOUND 199 */ 200 virtual RState GetPluralStringByNameFormat(std::string &outValue, const char *name, int quantity, ...); 201 202 /** 203 * Get the THEME resource by resource id 204 * @param id the resource id 205 * @param outValue the resource write to 206 * @return SUCCESS if resource exist, else NOT_FOUND 207 */ 208 virtual RState GetThemeById(uint32_t id, std::map<std::string, std::string> &outValue); 209 210 /** 211 * Get the THEME resource by resource name 212 * @param name the resource name 213 * @param outValue the resource write to 214 * @return SUCCESS if resource exist, else NOT_FOUND 215 */ 216 virtual RState GetThemeByName(const char *name, std::map<std::string, std::string> &outValue); 217 218 /** 219 * Get the BOOLEAN resource by resource id 220 * @param id the resource id 221 * @param outValue the obtain boolean value write to 222 * @return SUCCESS if resource exist, else NOT_FOUND 223 */ 224 virtual RState GetBooleanById(uint32_t id, bool &outValue); 225 226 /** 227 * Get the BOOLEAN resource by resource name 228 * @param name the resource name 229 * @param outValue the obtain boolean value write to 230 * @return SUCCESS if resource exist, else NOT_FOUND 231 */ 232 virtual RState GetBooleanByName(const char *name, bool &outValue); 233 234 /** 235 * Get the INTEGER resource by resource id 236 * @param id the resource id 237 * @param outValue the obtain Integer value write to 238 * @return SUCCESS if resource exist, else NOT_FOUND 239 */ 240 virtual RState GetIntegerById(uint32_t id, int &outValue); 241 242 /** 243 * Get the INTEGER resource by resource name 244 * @param name the resource name 245 * @param outValue the obtain Integer value write to 246 * @return SUCCESS if resource exist, else NOT_FOUND 247 */ 248 virtual RState GetIntegerByName(const char *name, int &outValue); 249 250 /** 251 * Get the FLOAT resource by resource id 252 * @param id the resource id 253 * @param outValue the obtain float value write to 254 * @return SUCCESS if resource exist, else NOT_FOUND 255 */ 256 virtual RState GetFloatById(uint32_t id, float &outValue); 257 258 /** 259 * Get the FLOAT resource by resource id 260 * @param id the resource id 261 * @param outValue the obtain float value write to 262 * @param unit the unit do not in parsing 263 * @return SUCCESS if resource exist, else NOT_FOUND 264 */ 265 virtual RState GetFloatById(uint32_t id, float &outValue, std::string &unit); 266 267 /** 268 * Get the FLOAT resource by resource name 269 * @param name the resource name 270 * @param outValue the obtain float value write to 271 * @return SUCCESS if resource exist, else NOT_FOUND 272 */ 273 virtual RState GetFloatByName(const char *name, float &outValue); 274 275 /** 276 * Get the FLOAT resource by resource id 277 * @param id the resource id 278 * @param outValue the obtain float value write to 279 * @param unit the string do not in parsing 280 * @return SUCCESS if resource exist, else NOT_FOUND 281 */ 282 virtual RState GetFloatByName(const char *name, float &outValue, std::string &unit); 283 284 /** 285 * Get the INTARRAY resource by resource id 286 * @param id the resource id 287 * @param outValue the obtain resource value convert to vector<int> write to 288 * @return SUCCESS if resource exist, else NOT_FOUND 289 */ 290 virtual RState GetIntArrayById(uint32_t id, std::vector<int> &outValue); 291 292 /** 293 * Get the INTARRAY resource by resource name 294 * @param name the resource name 295 * @param outValue the obtain resource value convert to vector<int> write to 296 * @return SUCCESS if resource exist, else NOT_FOUND 297 */ 298 virtual RState GetIntArrayByName(const char *name, std::vector<int> &outValue); 299 300 /** 301 * Get the COLOR resource by resource id 302 * @param id the resource id 303 * @param outValue the obtain resource value convert to uint32_t write to 304 * @return SUCCESS if resource exist, else NOT_FOUND 305 */ 306 virtual RState GetColorById(uint32_t id, uint32_t &outValue); 307 308 /** 309 * Get the COLOR resource by resource name 310 * @param name the resource name 311 * @param outValue the obtain resource value convert to uint32_t write to 312 * @return SUCCESS if resource exist, else NOT_FOUND 313 */ 314 virtual RState GetColorByName(const char *name, uint32_t &outValue); 315 316 /** 317 * Get the SYMBOL resource by resource id 318 * @param id the resource id 319 * @param outValue the obtain resource value convert to uint32_t write to 320 * @return SUCCESS if resource exist, else NOT_FOUND 321 */ 322 virtual RState GetSymbolById(uint32_t id, uint32_t &outValue); 323 324 /** 325 * Get the SYMBOL resource by resource name 326 * @param name the resource name 327 * @param outValue the obtain resource value convert to uint32_t write to 328 * @return SUCCESS if resource exist, else NOT_FOUND 329 */ 330 virtual RState GetSymbolByName(const char *name, uint32_t &outValue); 331 332 /** 333 * Get the PROF resource by resource id 334 * @param id the resource id 335 * @param outValue the obtain resource path write to 336 * @return SUCCESS if resource exist, else NOT_FOUND 337 */ 338 virtual RState GetProfileById(uint32_t id, std::string &outValue); 339 340 /** 341 * Get the PROF resource by resource name 342 * @param name the resource name 343 * @param outValue the obtain resource path write to 344 * @return SUCCESS if resource exist, else NOT_FOUND 345 */ 346 virtual RState GetProfileByName(const char *name, std::string &outValue); 347 348 /** 349 * Get the MEDIA resource by resource id 350 * @param id the resource id 351 * @param outValue the obtain resource path write to 352 * @param density the screen density, within the area of OHOS::Global::Resource::ScreenDensity 353 * @return SUCCESS if resource exist, else NOT_FOUND 354 */ 355 virtual RState GetMediaById(uint32_t id, std::string &outValue, uint32_t density = 0); 356 357 /** 358 * Get the MEDIA resource by resource name 359 * @param name the resource name 360 * @param outValue the obtain resource path write to 361 * @param density the screen density, within the area of OHOS::Global::Resource::ScreenDensity 362 * @return SUCCESS if resource exist, else NOT_FOUND 363 */ 364 virtual RState GetMediaByName(const char *name, std::string &outValue, uint32_t density = 0); 365 366 /** 367 * Get the raw file path by resource name 368 * @param name the resource name 369 * @param outValue the obtain resource path write to 370 * @return SUCCESS if resource exist, else NOT_FOUND 371 */ 372 virtual RState GetRawFilePathByName(const std::string &name, std::string &outValue); 373 374 /** 375 * Get the rawFile descriptor by resource name 376 * @param name the resource name 377 * @param descriptor the obtain raw file member fd, length, offet write to 378 * @return SUCCESS if resource exist, else ERROR 379 */ 380 virtual RState GetRawFileDescriptor(const std::string &name, RawFileDescriptor &descriptor); 381 382 /** 383 * Get the rawFile descriptor by resource name 384 * @param name the resource name 385 * @param descriptor the obtain raw file member fd, length, offet write to 386 * @return SUCCESS if resource exist, else ERROR 387 */ 388 virtual RState GetRawFdNdkFromHap(const std::string &name, RawFileDescriptor &descriptor); 389 390 /** 391 * Close rawFile descriptor by resource name 392 * @param name the resource name 393 * @return SUCCESS if close the rawFile descriptor, else ERROR 394 */ 395 virtual RState CloseRawFileDescriptor(const std::string &name); 396 397 /** 398 * Get all resource paths 399 * @return The vector of resource paths 400 */ 401 std::vector<std::string> GetResourcePaths(); 402 403 /** 404 * Get the MEDIA data by resource id 405 * @param id the resource id 406 * @param len the data len write to 407 * @param outValue the obtain resource path write to 408 * @param density the screen density, within the area of OHOS::Global::Resource::ScreenDensity 409 * @return SUCCESS if resource exist, else NOT_FOUND 410 */ 411 virtual RState GetMediaDataById(uint32_t id, size_t &len, std::unique_ptr<uint8_t[]> &outValue, 412 uint32_t density = 0); 413 414 /** 415 * Get the MEDIA data by resource name 416 * @param name the resource name 417 * @param len the data len write to 418 * @param outValue the obtain resource path write to 419 * @param density the screen density, within the area of OHOS::Global::Resource::ScreenDensity 420 * @return SUCCESS if resource exist, else NOT_FOUND 421 */ 422 virtual RState GetMediaDataByName(const char *name, size_t &len, std::unique_ptr<uint8_t[]> &outValue, 423 uint32_t density = 0); 424 425 /** 426 * Get the MEDIA base64 data resource by resource id 427 * @param id the resource id 428 * @param outValue the media base64 data 429 * @param density the screen density, within the area of OHOS::Global::Resource::ScreenDensity 430 * @return SUCCESS if resource exist, else NOT_FOUND 431 */ 432 virtual RState GetMediaBase64DataById(uint32_t id, std::string &outValue, uint32_t density = 0); 433 434 /** 435 * Get the MEDIA base64 data resource by resource id 436 * @param name the resource name 437 * @param outValue the media base64 data 438 * @param density the screen density, within the area of OHOS::Global::Resource::ScreenDensity 439 * @return SUCCESS if resource exist, else NOT_FOUND 440 */ 441 virtual RState GetMediaBase64DataByName(const char *name, std::string &outValue, uint32_t density = 0); 442 443 /** 444 * Get the PROF resource by resource id 445 * @param name the resource id 446 * @param len the data len write to 447 * @param outValue the obtain resource path write to 448 * @return SUCCESS if resource exist, else NOT_FOUND 449 */ 450 virtual RState GetProfileDataById(uint32_t id, size_t &len, std::unique_ptr<uint8_t[]> &outValue); 451 452 /** 453 * Get the PROF resource by resource name 454 * @param name the resource name 455 * @param len the data len write to 456 * @param outValue the obtain resource path write to 457 * @return SUCCESS if resource exist, else NOT_FOUND 458 */ 459 virtual RState GetProfileDataByName(const char *name, size_t &len, std::unique_ptr<uint8_t[]> &outValue); 460 461 /** 462 * Get the rawFile base64 from hap by rawFile name 463 * @param rawFileName the rawFile name 464 * @param len the data len write to 465 * @param outValue the obtain resource path write to 466 * @return SUCCESS if resource exist, else NOT_FOUND 467 */ 468 virtual RState GetRawFileFromHap(const std::string &rawFileName, size_t &len, 469 std::unique_ptr<uint8_t[]> &outValue); 470 471 /** 472 * Get the rawFile Descriptor from hap by rawFile name 473 * @param rawFileName the rawFile name 474 * @param descriptor the raw file member fd, length, offet write to 475 * @return SUCCESS if resource exist, else NOT_FOUND 476 */ 477 virtual RState GetRawFileDescriptorFromHap(const std::string &rawFileName, RawFileDescriptor &descriptor); 478 479 /** 480 * Is load hap 481 * @param hapPath the hap path 482 */ 483 virtual RState IsLoadHap(std::string &hapPath); 484 485 /** 486 * Get the raw file list 487 * @param rawDirPath the rawfile directory path 488 * @param rawfileList the rawfile list write to 489 * @return SUCCESS if resource exist, else not found 490 */ 491 virtual RState GetRawFileList(const std::string &rawDirPath, std::vector<std::string>& rawfileList); 492 493 /** 494 * Get the drawable information for given resId, mainly about type, len, buffer 495 * @param id the resource id 496 * @param type the drawable type 497 * @param len the drawable buffer length 498 * @param outValue the drawable buffer write to 499 * @param density the drawable density 500 * @return SUCCESS if resource exist, else not found 501 */ 502 virtual RState GetDrawableInfoById(uint32_t id, std::string &type, size_t &len, 503 std::unique_ptr<uint8_t[]> &outValue, uint32_t density = 0); 504 505 /** 506 * Get the drawable information for given resName, mainly about type, len, buffer 507 * @param name the resource Name 508 * @param type the drawable type 509 * @param len the drawable buffer length 510 * @param outValue the drawable buffer write to 511 * @param density the drawable density 512 * @return SUCCESS if resource exist, else not found 513 */ 514 virtual RState GetDrawableInfoByName(const char *name, std::string &type, size_t &len, 515 std::unique_ptr<uint8_t[]> &outValue, uint32_t density = 0); 516 517 /** 518 * Get string format by resource id 519 * @param id the resource id 520 * @param outValue the resource write to 521 * @param jsParams the formatting string resource js parameters, the tuple first parameter represents the type, 522 * napi_number is denoted by NAPI_NUMBER, napi_string is denoted by NAPI_STRING, 523 * the tuple second parameter represents the value 524 * @return SUCCESS if resource exists and was formatted successfully, else ERROR 525 */ 526 virtual RState GetStringFormatById(uint32_t id, std::string &outValue, 527 std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> &jsParams); 528 529 /** 530 * Get string format by resource name 531 * @param name the resource name 532 * @param outValue the resource write to 533 * @param jsParams the formatting string resource js parameters, the tuple first parameter represents the type, 534 * napi_number is denoted by NAPI_NUMBER, napi_string is denoted by NAPI_STRING, 535 * the tuple second parameter represents the value 536 * @return SUCCESS if resource exists and was formatted successfully, else ERROR 537 */ 538 virtual RState GetStringFormatByName(const char *name, std::string &outValue, 539 std::vector<std::tuple<ResourceManager::NapiValueType, std::string>> &jsParams); 540 541 /** 542 * Get the resource limit keys value which every binary bit corresponds to existing limit key {@link KeyType}, 543 * enum KeyType { 544 * LANGUAGES = 0, 545 * REGION = 1, 546 * SCREEN_DENSITY = 2, 547 * DIRECTION = 3, 548 * DEVICETYPE = 4, 549 * SCRIPT = 5, 550 * COLORMODE = 6 551 * MCC = 7, 552 * MNC = 8, 553 * // RESERVER 9 554 * INPUTDEVICE = 10, 555 * KEY_TYPE_MAX, 556 * } 557 * 558 * @return the resource limit keys, like if resource has LANGUAGES/REGION/DEVICETYPE, then the return value to 559 * binary bits is 0000010011 560 */ 561 virtual uint32_t GetResourceLimitKeys(); 562 563 /** 564 * Get the resource id by resType and resName 565 * 566 * @param resTypeName the resType and resName 567 * @param resId the resId write to 568 * @return SUCCESS if resource exist, else ERROR 569 */ 570 virtual RState GetResId(const std::string &resTypeName, uint32_t &resId); 571 572 /** 573 * Get locale list 574 * 575 * @param outValue the locales write to, the locale string is divided into three parts: language, 576 * script (optional), and region (optional), concatenated by the connector (-). 577 * @param includeSystem the parameter controls whether to include system resources, 578 * the default value is false, it has no effect when only system resources query the locales list. 579 */ 580 virtual void GetLocales(std::vector<std::string> &outValue, bool includeSystem = false); 581 582 /** 583 * Get the drawable information for given resId, mainly about type, len, buffer 584 * @param id the resource id 585 * @param drawableInfo the drawable info 586 * @param outValue the drawable buffer write to 587 * @param iconType the drawable type 588 * @param density the drawable density 589 * @return SUCCESS if resource exist, else not found 590 */ 591 virtual RState GetDrawableInfoById(uint32_t id, 592 std::tuple<std::string, size_t, std::string> &drawableInfo, 593 std::unique_ptr<uint8_t[]> &outValue, uint32_t iconType, uint32_t density = 0); 594 595 /** 596 * Get the drawable information for given resName, mainly about type, len, buffer 597 * @param name the resource Name 598 * @param drawableInfo the drawable info 599 * @param outValue the drawable buffer write to 600 * @param iconType the drawable type 601 * @param density the drawable density 602 * @return SUCCESS if resource exist, else not found 603 */ 604 virtual RState GetDrawableInfoByName(const char *name, 605 std::tuple<std::string, size_t, std::string> &drawableInfo, 606 std::unique_ptr<uint8_t[]> &outValue, uint32_t iconType, uint32_t density = 0); 607 608 /** 609 * Get the theme icon from theme pack 610 * 611 * @param resId the resource id 612 * @param foregroundInfo the foreground info 613 * @param backgroundInfo the background info 614 * @param density the drawable density 615 * @return SUCCESS if resource exist, else not found 616 */ 617 virtual RState GetThemeIcons(uint32_t resId, std::pair<std::unique_ptr<uint8_t[]>, size_t> &foregroundInfo, 618 std::pair<std::unique_ptr<uint8_t[]>, size_t> &backgroundInfo, uint32_t density = 0); 619 620 /** 621 * Get the theme mask 622 * 623 * @return the theme mask path, else empty 624 */ 625 virtual std::string GetThemeMask(); 626 627 private: 628 RState GetString(const IdItem *idItem, std::string &outValue); 629 630 RState GetStringArray(const IdItem *idItem, std::vector<std::string> &outValue); 631 632 RState GetPattern(const IdItem *idItem, std::map<std::string, std::string> &outValue); 633 634 RState GetTheme(const IdItem *idItem, std::map<std::string, std::string> &outValue); 635 636 RState GetPluralString(const HapResource::ValueUnderQualifierDir *vuqd, int quantity, std::string &outValue); 637 638 RState ResolveReference(const std::string value, std::string &outValue); 639 640 RState GetBoolean(const IdItem *idItem, bool &outValue); 641 642 RState ParseFloat(const std::string &strValue, float &result, std::string &unit); 643 644 RState RecalculateFloat(const std::string &unit, float &result); 645 646 RState GetFloat(const IdItem *idItem, float &outValue, std::string &unit); 647 648 RState GetInteger(const IdItem *idItem, int &outValue); 649 650 RState GetColor(const IdItem *idItem, uint32_t &outValue); 651 652 RState GetIntArray(const IdItem *idItem, std::vector<int> &outValue); 653 654 RState GetSymbol(const IdItem *idItem, uint32_t &outValue); 655 656 void ProcessPsuedoTranslate(std::string &outValue); 657 658 RState ResolveParentReference(const IdItem *idItem, std::map<std::string, std::string> &outValue); 659 660 bool IsDensityValid(uint32_t density); 661 662 bool IsFileExist(const std::string& path); 663 664 RState GetThemeColor(const IdItem *idItem, uint32_t &outValue); 665 666 RState GetThemeFloat(const IdItem *idItem, float &outValue); 667 668 RState GetThemeMedia(const IdItem *idItem, size_t &len, std::unique_ptr<uint8_t[]> &outValue, uint32_t density); 669 670 RState GetThemeMediaBase64(const IdItem *idItem, std::string &outValue); 671 672 RState GetThemeDrawable(const IdItem *idItem, size_t &len, std::unique_ptr<uint8_t[]> &outValue, 673 uint32_t iconType, uint32_t density); 674 675 RState GetThemeIcon(const IdItem *idItem, size_t &len, std::unique_ptr<uint8_t[]> &outValue, uint32_t density); 676 677 RState ProcessReference(const std::string value, std::vector<const IdItem *> &idItems); 678 679 RState GetThemeIconInfo(const std::string &iconName, size_t &len, std::unique_ptr<uint8_t[]> &outValue); 680 681 RState GetThemeValues(const std::string &value, std::string &outValue); 682 683 HapManager *hapManager_; 684 685 float fontRatio_ = 0.0f; 686 687 bool isFakeLocale = false; 688 689 bool isBidirectionFakeLocale = false; 690 691 PsueManager *psueManager_; 692 693 const std::string VIRTUAL_PIXEL = "vp"; 694 695 const std::string FONT_SIZE_PIXEL = "fp"; 696 }; 697 } // namespace Resource 698 } // namespace Global 699 } // namespace OHOS 700 #endif