nsIURI 没有成员“asciiSpec”、“asciiHost”等错误
我对 Mozilla (6.0.2) 代码中的 nsMediaStream.h/cpp 进行了一些修改,其中之一要求我从 Mozilla 框架用于表示和解析 URI 的 nsIURI 类中获取 ASCII 字符串。人们可能会想,这似乎很容易。 Mozilla 文档 (https://developer.mozilla.org/en/nsIURI) 告诉我我可以使用属性 asciiSpec 来获取这样的字符串。 nsACString 的文档非常混乱,但那是另一回事了。
问题在于,当我尝试使用 nsMediaStream 的 nsIURI 变量 mURI 时,
mURI->asciiSpec
我从 MSVC 编译器中收到以下错误:
[..]/content/media/nsMediaStream.cpp(146) :
error C2039: 'asciiSpec' : is not a member of 'nsIURI'
[..]\obj-i686-pc-mingw32\dist\include\nsIURI.h(83) : see declaration of 'nsIURI'
当我查看引用的 nsIURI.h 文件(该文件是从接口 IDL 文件生成的)时,我看到以下: http://google -web-toolkit.googlecode.com/svn/plugin-sdks/gecko-sdks/gecko-1.9.0/include/nsIURI.h
据我所知可以看出,所述头文件与 Mozilla 代码中使用的 nsIURI 完全无关,并且看起来更像是接口/原型而不是实际的类。文档中列出的属性和方法都不存在。 MSVC 似乎同意我的观点。
我觉得我在这里错过了一些大东西,但即使在 Mozilla 源代码中花费了几个月的时间并在构建系统中幸存下来之后,我似乎也无法弄清楚这个问题,到目前为止我问过的其他人也无法弄清楚。任何线索将不胜感激:)
I have made some modifications to nsMediaStream.h/cpp in the Mozilla (6.0.2) code and one of them requires that I get the ASCII string from the nsIURI class used by the Mozilla framework for representing and parsing URIs. Seems easy enough, one might think. The Mozilla documentation (https://developer.mozilla.org/en/nsIURI) tells me that I can use the attribute asciiSpec to obtain such a string. The documentation for nsACString is horribly confusing, but that's another matter.
Where things go south is that when I try to use the nsIURI variable mURI of nsMediaStream using
mURI->asciiSpec
I get the following error from the MSVC compiler:
[..]/content/media/nsMediaStream.cpp(146) :
error C2039: 'asciiSpec' : is not a member of 'nsIURI'
[..]\obj-i686-pc-mingw32\dist\include\nsIURI.h(83) : see declaration of 'nsIURI'
When I look at the referenced nsIURI.h file, which is generated from an interface IDL file, I see the following: http://google-web-toolkit.googlecode.com/svn/plugin-sdks/gecko-sdks/gecko-1.9.0/include/nsIURI.h
As far as I can tell said header file has no relevance at all to nsIURI as used in the Mozilla code and seems more of an interface/prototype than an actual class. None of the attributes and methods listed in the documentation are present. MSVC seems to agree with me on this.
I feel like I'm missing something big here, but even after spending months in the Mozilla source and surviving the build system I can't seem to figure this one out, nor can anyone else I have asked so far. Any clues would be more than appreciated :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当从 C++ 使用 XPCOM 时,没有属性 - 所有接口属性都转换为 getter/setter 方法。接口定义文件(IDL 文件)使用 xpidl 工具编译为常规 C++ 头文件 - 因此您找到的文件是正确的,但它是自动生成的。您将获得如下所示的
asciiSpec
属性:没有
SetAsciiSpec
方法,因为此属性是只读的。When using XPCOM from C++ there are no properties - all interface properties are transformed into getter/setter methods. The interface definition files (IDL files) are compiled into regular C++ header files using
xpidl
tool - so the file you found is the correct one but it is generated automatically. You would getasciiSpec
property like this:There is no
SetAsciiSpec
method because this property is read-only.