Skip to content

Commit 19fcc97

Browse files
committed
Simplify class name handling
1 parent 9d1115a commit 19fcc97

21 files changed

+1563
-1571
lines changed

Generator/NameHelpers.cs

-6
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ public static string CamelToSnakeCase(string name)
4646
return newName.ToString();
4747
}
4848

49-
// Returns the string as an UTF16 encoded, null-terminated sequence of u16 values
50-
public static string StringToUTF16WithZero(string str)
51-
{
52-
return String.Join(",", str.Select(c => ((ushort)c).ToString()).Concat(new string[] { "0" }));
53-
}
54-
5549
public static Tuple<string, int> GetSortKeyIgnoringInterfacePrefix(string str)
5650
{
5751
if (str[0] == 'I' && char.IsUpper(str[1]))

Generator/Types/ClassDef.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public override void Emit()
137137
if (needClassID)
138138
{
139139
Module.Append($@"
140-
DEFINE_CLSID!({ classType }(&[{ NameHelpers.StringToUTF16WithZero(Type.FullName) }]) [CLSID_{ classType }]);");
140+
DEFINE_CLSID!({ classType }: ""{ Type.FullName }"");");
141141
}
142142
}
143143
}

src/rt/gen/windows/applicationmodel.rs

+195-195
Large diffs are not rendered by default.

src/rt/gen/windows/data.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl JsonArray {
4646
<Self as RtActivatable<IJsonArrayStatics>>::get_activation_factory().try_parse(input)
4747
}}
4848
}
49-
DEFINE_CLSID!(JsonArray(&[87,105,110,100,111,119,115,46,68,97,116,97,46,74,115,111,110,46,74,115,111,110,65,114,114,97,121,0]) [CLSID_JsonArray]);
49+
DEFINE_CLSID!(JsonArray: "Windows.Data.Json.JsonArray");
5050
DEFINE_IID!(IID_IJsonArrayStatics, 3675534505, 57700, 18847, 147, 226, 138, 143, 73, 187, 144, 186);
5151
RT_INTERFACE!{static interface IJsonArrayStatics(IJsonArrayStaticsVtbl): IInspectable(IInspectableVtbl) [IID_IJsonArrayStatics] {
5252
fn Parse(&self, input: HSTRING, out: *mut *mut JsonArray) -> HRESULT,
@@ -71,7 +71,7 @@ impl JsonError {
7171
<Self as RtActivatable<IJsonErrorStatics2>>::get_activation_factory().get_json_status(hresult)
7272
}}
7373
}
74-
DEFINE_CLSID!(JsonError(&[87,105,110,100,111,119,115,46,68,97,116,97,46,74,115,111,110,46,74,115,111,110,69,114,114,111,114,0]) [CLSID_JsonError]);
74+
DEFINE_CLSID!(JsonError: "Windows.Data.Json.JsonError");
7575
DEFINE_IID!(IID_IJsonErrorStatics2, 1077948634, 34768, 17260, 131, 171, 252, 123, 18, 192, 204, 38);
7676
RT_INTERFACE!{static interface IJsonErrorStatics2(IJsonErrorStatics2Vtbl): IInspectable(IInspectableVtbl) [IID_IJsonErrorStatics2] {
7777
fn GetJsonStatus(&self, hresult: i32, out: *mut JsonErrorStatus) -> HRESULT
@@ -143,7 +143,7 @@ impl JsonObject {
143143
<Self as RtActivatable<IJsonObjectStatics>>::get_activation_factory().try_parse(input)
144144
}}
145145
}
146-
DEFINE_CLSID!(JsonObject(&[87,105,110,100,111,119,115,46,68,97,116,97,46,74,115,111,110,46,74,115,111,110,79,98,106,101,99,116,0]) [CLSID_JsonObject]);
146+
DEFINE_CLSID!(JsonObject: "Windows.Data.Json.JsonObject");
147147
DEFINE_IID!(IID_IJsonObjectStatics, 579465561, 21726, 17880, 171, 204, 34, 96, 63, 160, 102, 160);
148148
RT_INTERFACE!{static interface IJsonObjectStatics(IJsonObjectStaticsVtbl): IInspectable(IInspectableVtbl) [IID_IJsonObjectStatics] {
149149
fn Parse(&self, input: HSTRING, out: *mut *mut JsonObject) -> HRESULT,
@@ -272,7 +272,7 @@ impl JsonValue {
272272
<Self as RtActivatable<IJsonValueStatics2>>::get_activation_factory().create_null_value()
273273
}}
274274
}
275-
DEFINE_CLSID!(JsonValue(&[87,105,110,100,111,119,115,46,68,97,116,97,46,74,115,111,110,46,74,115,111,110,86,97,108,117,101,0]) [CLSID_JsonValue]);
275+
DEFINE_CLSID!(JsonValue: "Windows.Data.Json.JsonValue");
276276
DEFINE_IID!(IID_IJsonValueStatics, 1600869450, 12115, 18657, 145, 163, 247, 139, 80, 166, 52, 92);
277277
RT_INTERFACE!{static interface IJsonValueStatics(IJsonValueStaticsVtbl): IInspectable(IInspectableVtbl) [IID_IJsonValueStatics] {
278278
fn Parse(&self, input: HSTRING, out: *mut *mut JsonValue) -> HRESULT,
@@ -582,7 +582,7 @@ impl XmlDocument {
582582
<Self as RtActivatable<IXmlDocumentStatics>>::get_activation_factory().load_from_file_with_settings_async(file, loadSettings)
583583
}}
584584
}
585-
DEFINE_CLSID!(XmlDocument(&[87,105,110,100,111,119,115,46,68,97,116,97,46,88,109,108,46,68,111,109,46,88,109,108,68,111,99,117,109,101,110,116,0]) [CLSID_XmlDocument]);
585+
DEFINE_CLSID!(XmlDocument: "Windows.Data.Xml.Dom.XmlDocument");
586586
DEFINE_IID!(IID_IXmlDocumentFragment, 3807013526, 3105, 17573, 139, 201, 158, 74, 38, 39, 8, 236);
587587
RT_INTERFACE!{interface IXmlDocumentFragment(IXmlDocumentFragmentVtbl): IInspectable(IInspectableVtbl) [IID_IXmlDocumentFragment] {
588588

@@ -836,7 +836,7 @@ impl IXmlLoadSettings {
836836
}
837837
RT_CLASS!{class XmlLoadSettings: IXmlLoadSettings}
838838
impl RtActivatable<IActivationFactory> for XmlLoadSettings {}
839-
DEFINE_CLSID!(XmlLoadSettings(&[87,105,110,100,111,119,115,46,68,97,116,97,46,88,109,108,46,68,111,109,46,88,109,108,76,111,97,100,83,101,116,116,105,110,103,115,0]) [CLSID_XmlLoadSettings]);
839+
DEFINE_CLSID!(XmlLoadSettings: "Windows.Data.Xml.Dom.XmlLoadSettings");
840840
DEFINE_IID!(IID_IXmlNamedNodeMap, 3014041264, 43696, 19330, 166, 250, 177, 69, 63, 124, 2, 27);
841841
RT_INTERFACE!{interface IXmlNamedNodeMap(IXmlNamedNodeMapVtbl): IInspectable(IInspectableVtbl) [IID_IXmlNamedNodeMap] {
842842
fn get_Length(&self, out: *mut u32) -> HRESULT,
@@ -1156,7 +1156,7 @@ impl XsltProcessor {
11561156
<Self as RtActivatable<IXsltProcessorFactory>>::get_activation_factory().create_instance(document)
11571157
}}
11581158
}
1159-
DEFINE_CLSID!(XsltProcessor(&[87,105,110,100,111,119,115,46,68,97,116,97,46,88,109,108,46,88,115,108,46,88,115,108,116,80,114,111,99,101,115,115,111,114,0]) [CLSID_XsltProcessor]);
1159+
DEFINE_CLSID!(XsltProcessor: "Windows.Data.Xml.Xsl.XsltProcessor");
11601160
DEFINE_IID!(IID_IXsltProcessor2, 2376358998, 38821, 17611, 168, 190, 39, 216, 98, 128, 199, 10);
11611161
RT_INTERFACE!{interface IXsltProcessor2(IXsltProcessor2Vtbl): IInspectable(IInspectableVtbl) [IID_IXsltProcessor2] {
11621162
fn TransformToDocument(&self, inputNode: *mut super::dom::IXmlNode, out: *mut *mut super::dom::XmlDocument) -> HRESULT
@@ -1201,7 +1201,7 @@ impl HtmlUtilities {
12011201
<Self as RtActivatable<IHtmlUtilities>>::get_activation_factory().convert_to_text(html)
12021202
}}
12031203
}
1204-
DEFINE_CLSID!(HtmlUtilities(&[87,105,110,100,111,119,115,46,68,97,116,97,46,72,116,109,108,46,72,116,109,108,85,116,105,108,105,116,105,101,115,0]) [CLSID_HtmlUtilities]);
1204+
DEFINE_CLSID!(HtmlUtilities: "Windows.Data.Html.HtmlUtilities");
12051205
} // Windows.Data.Html
12061206
pub mod pdf { // Windows.Data.Pdf
12071207
use ::prelude::*;
@@ -1244,7 +1244,7 @@ impl PdfDocument {
12441244
<Self as RtActivatable<IPdfDocumentStatics>>::get_activation_factory().load_from_stream_with_password_async(inputStream, password)
12451245
}}
12461246
}
1247-
DEFINE_CLSID!(PdfDocument(&[87,105,110,100,111,119,115,46,68,97,116,97,46,80,100,102,46,80,100,102,68,111,99,117,109,101,110,116,0]) [CLSID_PdfDocument]);
1247+
DEFINE_CLSID!(PdfDocument: "Windows.Data.Pdf.PdfDocument");
12481248
DEFINE_IID!(IID_IPdfDocumentStatics, 1127877471, 49159, 18312, 144, 242, 8, 20, 61, 146, 37, 153);
12491249
RT_INTERFACE!{static interface IPdfDocumentStatics(IPdfDocumentStaticsVtbl): IInspectable(IInspectableVtbl) [IID_IPdfDocumentStatics] {
12501250
#[cfg(feature="windows-storage")] fn LoadFromFileAsync(&self, file: *mut super::super::storage::IStorageFile, out: *mut *mut super::super::foundation::IAsyncOperation<PdfDocument>) -> HRESULT,
@@ -1441,7 +1441,7 @@ impl IPdfPageRenderOptions {
14411441
}
14421442
RT_CLASS!{class PdfPageRenderOptions: IPdfPageRenderOptions}
14431443
impl RtActivatable<IActivationFactory> for PdfPageRenderOptions {}
1444-
DEFINE_CLSID!(PdfPageRenderOptions(&[87,105,110,100,111,119,115,46,68,97,116,97,46,80,100,102,46,80,100,102,80,97,103,101,82,101,110,100,101,114,79,112,116,105,111,110,115,0]) [CLSID_PdfPageRenderOptions]);
1444+
DEFINE_CLSID!(PdfPageRenderOptions: "Windows.Data.Pdf.PdfPageRenderOptions");
14451445
RT_ENUM! { enum PdfPageRotation: i32 {
14461446
Normal (PdfPageRotation_Normal) = 0, Rotate90 (PdfPageRotation_Rotate90) = 1, Rotate180 (PdfPageRotation_Rotate180) = 2, Rotate270 (PdfPageRotation_Rotate270) = 3,
14471447
}}
@@ -1538,7 +1538,7 @@ impl SelectableWordsSegmenter {
15381538
<Self as RtActivatable<ISelectableWordsSegmenterFactory>>::get_activation_factory().create_with_language(language)
15391539
}}
15401540
}
1541-
DEFINE_CLSID!(SelectableWordsSegmenter(&[87,105,110,100,111,119,115,46,68,97,116,97,46,84,101,120,116,46,83,101,108,101,99,116,97,98,108,101,87,111,114,100,115,83,101,103,109,101,110,116,101,114,0]) [CLSID_SelectableWordsSegmenter]);
1541+
DEFINE_CLSID!(SelectableWordsSegmenter: "Windows.Data.Text.SelectableWordsSegmenter");
15421542
DEFINE_IID!(IID_ISelectableWordsSegmenterFactory, 2356835912, 24663, 17209, 188, 112, 242, 16, 1, 10, 65, 80);
15431543
RT_INTERFACE!{static interface ISelectableWordsSegmenterFactory(ISelectableWordsSegmenterFactoryVtbl): IInspectable(IInspectableVtbl) [IID_ISelectableWordsSegmenterFactory] {
15441544
fn CreateWithLanguage(&self, language: HSTRING, out: *mut *mut SelectableWordsSegmenter) -> HRESULT
@@ -1577,7 +1577,7 @@ impl SemanticTextQuery {
15771577
<Self as RtActivatable<ISemanticTextQueryFactory>>::get_activation_factory().create_with_language(aqsFilter, filterLanguage)
15781578
}}
15791579
}
1580-
DEFINE_CLSID!(SemanticTextQuery(&[87,105,110,100,111,119,115,46,68,97,116,97,46,84,101,120,116,46,83,101,109,97,110,116,105,99,84,101,120,116,81,117,101,114,121,0]) [CLSID_SemanticTextQuery]);
1580+
DEFINE_CLSID!(SemanticTextQuery: "Windows.Data.Text.SemanticTextQuery");
15811581
DEFINE_IID!(IID_ISemanticTextQueryFactory, 596378883, 63893, 17799, 135, 119, 162, 183, 216, 10, 207, 239);
15821582
RT_INTERFACE!{static interface ISemanticTextQueryFactory(ISemanticTextQueryFactoryVtbl): IInspectable(IInspectableVtbl) [IID_ISemanticTextQueryFactory] {
15831583
fn Create(&self, aqsFilter: HSTRING, out: *mut *mut SemanticTextQuery) -> HRESULT,
@@ -1631,7 +1631,7 @@ impl TextConversionGenerator {
16311631
<Self as RtActivatable<ITextConversionGeneratorFactory>>::get_activation_factory().create(languageTag)
16321632
}}
16331633
}
1634-
DEFINE_CLSID!(TextConversionGenerator(&[87,105,110,100,111,119,115,46,68,97,116,97,46,84,101,120,116,46,84,101,120,116,67,111,110,118,101,114,115,105,111,110,71,101,110,101,114,97,116,111,114,0]) [CLSID_TextConversionGenerator]);
1634+
DEFINE_CLSID!(TextConversionGenerator: "Windows.Data.Text.TextConversionGenerator");
16351635
DEFINE_IID!(IID_ITextConversionGeneratorFactory, 4239013761, 12419, 18859, 190, 21, 86, 223, 187, 183, 77, 111);
16361636
RT_INTERFACE!{static interface ITextConversionGeneratorFactory(ITextConversionGeneratorFactoryVtbl): IInspectable(IInspectableVtbl) [IID_ITextConversionGeneratorFactory] {
16371637
fn Create(&self, languageTag: HSTRING, out: *mut *mut TextConversionGenerator) -> HRESULT
@@ -1697,7 +1697,7 @@ impl TextPredictionGenerator {
16971697
<Self as RtActivatable<ITextPredictionGeneratorFactory>>::get_activation_factory().create(languageTag)
16981698
}}
16991699
}
1700-
DEFINE_CLSID!(TextPredictionGenerator(&[87,105,110,100,111,119,115,46,68,97,116,97,46,84,101,120,116,46,84,101,120,116,80,114,101,100,105,99,116,105,111,110,71,101,110,101,114,97,116,111,114,0]) [CLSID_TextPredictionGenerator]);
1700+
DEFINE_CLSID!(TextPredictionGenerator: "Windows.Data.Text.TextPredictionGenerator");
17011701
DEFINE_IID!(IID_ITextPredictionGeneratorFactory, 1918350358, 35746, 18257, 157, 48, 157, 133, 67, 86, 83, 162);
17021702
RT_INTERFACE!{static interface ITextPredictionGeneratorFactory(ITextPredictionGeneratorFactoryVtbl): IInspectable(IInspectableVtbl) [IID_ITextPredictionGeneratorFactory] {
17031703
fn Create(&self, languageTag: HSTRING, out: *mut *mut TextPredictionGenerator) -> HRESULT
@@ -1739,7 +1739,7 @@ impl TextReverseConversionGenerator {
17391739
<Self as RtActivatable<ITextReverseConversionGeneratorFactory>>::get_activation_factory().create(languageTag)
17401740
}}
17411741
}
1742-
DEFINE_CLSID!(TextReverseConversionGenerator(&[87,105,110,100,111,119,115,46,68,97,116,97,46,84,101,120,116,46,84,101,120,116,82,101,118,101,114,115,101,67,111,110,118,101,114,115,105,111,110,71,101,110,101,114,97,116,111,114,0]) [CLSID_TextReverseConversionGenerator]);
1742+
DEFINE_CLSID!(TextReverseConversionGenerator: "Windows.Data.Text.TextReverseConversionGenerator");
17431743
DEFINE_IID!(IID_ITextReverseConversionGenerator2, 447730412, 34262, 18173, 130, 138, 58, 72, 48, 250, 110, 24);
17441744
RT_INTERFACE!{interface ITextReverseConversionGenerator2(ITextReverseConversionGenerator2Vtbl): IInspectable(IInspectableVtbl) [IID_ITextReverseConversionGenerator2] {
17451745
fn GetPhonemesAsync(&self, input: HSTRING, out: *mut *mut super::super::foundation::IAsyncOperation<super::super::foundation::collections::IVectorView<TextPhoneme>>) -> HRESULT
@@ -1820,7 +1820,7 @@ impl UnicodeCharacters {
18201820
<Self as RtActivatable<IUnicodeCharactersStatics>>::get_activation_factory().get_general_category(codepoint)
18211821
}}
18221822
}
1823-
DEFINE_CLSID!(UnicodeCharacters(&[87,105,110,100,111,119,115,46,68,97,116,97,46,84,101,120,116,46,85,110,105,99,111,100,101,67,104,97,114,97,99,116,101,114,115,0]) [CLSID_UnicodeCharacters]);
1823+
DEFINE_CLSID!(UnicodeCharacters: "Windows.Data.Text.UnicodeCharacters");
18241824
DEFINE_IID!(IID_IUnicodeCharactersStatics, 2542837383, 37521, 20369, 182, 200, 182, 227, 89, 215, 167, 251);
18251825
RT_INTERFACE!{static interface IUnicodeCharactersStatics(IUnicodeCharactersStaticsVtbl): IInspectable(IInspectableVtbl) [IID_IUnicodeCharactersStatics] {
18261826
fn GetCodepointFromSurrogatePair(&self, highSurrogate: u32, lowSurrogate: u32, out: *mut u32) -> HRESULT,
@@ -2003,7 +2003,7 @@ impl WordsSegmenter {
20032003
<Self as RtActivatable<IWordsSegmenterFactory>>::get_activation_factory().create_with_language(language)
20042004
}}
20052005
}
2006-
DEFINE_CLSID!(WordsSegmenter(&[87,105,110,100,111,119,115,46,68,97,116,97,46,84,101,120,116,46,87,111,114,100,115,83,101,103,109,101,110,116,101,114,0]) [CLSID_WordsSegmenter]);
2006+
DEFINE_CLSID!(WordsSegmenter: "Windows.Data.Text.WordsSegmenter");
20072007
DEFINE_IID!(IID_IWordsSegmenterFactory, 3868684916, 64565, 17756, 139, 251, 109, 127, 70, 83, 202, 151);
20082008
RT_INTERFACE!{static interface IWordsSegmenterFactory(IWordsSegmenterFactoryVtbl): IInspectable(IInspectableVtbl) [IID_IWordsSegmenterFactory] {
20092009
fn CreateWithLanguage(&self, language: HSTRING, out: *mut *mut WordsSegmenter) -> HRESULT

0 commit comments

Comments
 (0)