public int getSkuIdCount () {\r
return this.skuData.size();\r
}\r
- \r
+\r
+ private void getCurrentSizeFromDefaultValue (String str, ArrayList<Integer> al) {\r
+ if (isValidNullValue(str)) {\r
+ al.add(new Integer(0));\r
+ } else {\r
+ //\r
+ // isValidNullValue has already make sure that str here\r
+ // always contain a valid default value of the following 3\r
+ // cases:\r
+ // 1) "Hello world" //Assci string\r
+ // 2) L"Hello" //Unicode string\r
+ // 3) {0x01, 0x02, 0x03} //Byte stream\r
+ //\r
+ if (str.startsWith("\"")) {\r
+ al.add(new Integer(str.length() - 2));\r
+ } else if (str.startsWith("L\"")){\r
+ //\r
+ // Unicode is 2 bytes each.\r
+ //\r
+ al.add(new Integer((str.length() - 3) * 2));\r
+ } else if (str.startsWith("{")) {\r
+ //\r
+ // We count the number of "," in the string.\r
+ // The number of byte is one plus the number of \r
+ // comma.\r
+ //\r
+ String str2 = str;\r
+ \r
+ int cnt = 0;\r
+ int pos = 0;\r
+ pos = str2.indexOf(",", 0);\r
+ while (pos != -1) {\r
+ cnt++;\r
+ pos++;\r
+ pos = str2.indexOf(",", pos);\r
+ }\r
+ cnt++;\r
+ al.add(new Integer(cnt));\r
+ }\r
+ }\r
+ }\r
+ //\r
+ // This method can be used to get the MAX and current size\r
+ // for pointer type dynamic(ex) PCD entry\r
+ //\r
+ public ArrayList<Integer> getPointerTypeSize () {\r
+ ArrayList<Integer> al = new ArrayList<Integer>();\r
+ \r
+ //\r
+ // For VPD_enabled and HII_enabled, we can only return the MAX size.\r
+ // For the default DATA type dynamic PCD entry, we will return\r
+ // the MAX size and current size for each SKU_ID.\r
+ //\r
+ al.add(new Integer(this.datumSize));\r
+ \r
+ if (!this.isVpdEnable()) {\r
+ int idx;\r
+ if (this.isHiiEnable()){\r
+ for (idx = 0; idx < this.skuData.size(); idx++) {\r
+ String str = this.skuData.get(idx).value.hiiDefaultValue;\r
+ getCurrentSizeFromDefaultValue(str, al);\r
+ }\r
+ } else {\r
+ for (idx = 0; idx < this.skuData.size(); idx++) {\r
+ String str = this.skuData.get(idx).value.value;\r
+ getCurrentSizeFromDefaultValue(str, al);\r
+ }\r
+ }\r
+ }\r
+ \r
+ return al;\r
+ }\r
\r
/**\r
Get default value for a token, For HII type, HiiDefaultValue of default\r