什么是包装 [英] What is a Wrapper
问题描述
亲爱的,
在编程术语中,什么是包装器以及它在哪里使用?
问候
Dear all,
In programming terminology, what is a wrapper and where is it used?
Regards
推荐答案
您好
-
" utab" < um ******** @ gmail.comwrote in message
news:11 ********************** @ e3g2000cwe.googlegro ups.com ...
Hi
-
"utab" <um********@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
亲爱的,
在编程术语中,什么是包装器和在哪里使用?
Dear all,
In programming terminology, what is a wrapper and where is it used?
例如,您可以使用围绕常规C代码的C ++包装类。
例如在我的个人通用库中我有一个包装类
pnglib libary我可以打开一个.png文件的ifstream并用
运算符>读它或者用运算符<<写png文件;。这也适用于内存
streams等.C ++包装器负责内存分配并释放内存以及将指向静态成员的指针设置为
替换标准的C FILE导向操作。
即复杂性在C ++包装器类中。包装类
本身使用起来非常简单。每次我都可以用非常简单的方式加载和保存png,而不是查看png
的手册。
Well for instance you could use a C++ wrapper class around regular C code.
For instance in my personal generic library I have a wrapper class around
the pnglib libary I can the open an ifstream of a .png file and read it with
operator>or write png files with operator<<. This also works for memory
streams etc. The C++ wrapper takes care of memory allocation and freeing the
memory and of the complexity of setting the pointers to static members to
replace the standard C FILE oriented operations.
i.e. the complexity is inside the C++ wrapper class. The wrapper class
itself is extremely simple to use. Instead of looking in the manual of png
everytime I can now load and save png in a very simple way.
>
问候
>
Regards
问候,Ron AF Greve
http://moonlit.xs4all.nl
Moonlit写道:
Moonlit wrote:
嗨
-
" utab" < um ******** @ gmail.comwrote in message
news:11 ********************** @ e3g2000cwe.googlegro ups.com ...
Hi
-
"utab" <um********@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
亲爱的,
在编程术语中,什么是包装器和在哪里使用?
Dear all,
In programming terminology, what is a wrapper and where is it used?
例如,您可以使用围绕常规C代码的C ++包装类。
例如在我的个人通用库中我有一个包装类
pnglib libary我可以打开一个.png文件的ifstream并用
运算符>读它或者用运算符<<写png文件;。这也适用于内存
streams等.C ++包装器负责内存分配并释放内存以及将指向静态成员的指针设置为
替换标准的C FILE导向操作。
即复杂性在C ++包装器类中。包装类
本身使用起来非常简单。每次我都可以用非常简单的方式加载和保存png,而不是查看png
的手册。
Well for instance you could use a C++ wrapper class around regular C code.
For instance in my personal generic library I have a wrapper class around
the pnglib libary I can the open an ifstream of a .png file and read it with
operator>or write png files with operator<<. This also works for memory
streams etc. The C++ wrapper takes care of memory allocation and freeing the
memory and of the complexity of setting the pointers to static members to
replace the standard C FILE oriented operations.
i.e. the complexity is inside the C++ wrapper class. The wrapper class
itself is extremely simple to use. Instead of looking in the manual of png
everytime I can now load and save png in a very simple way.
问候
Regards
问候,Ron AF Greve
http://moonlit.xs4all.nl
感谢Ron,
因此,以简单的方式,它是一个代码块,可以使事情变得更加简单。
混合语言编程(对于原始的C库)在你的情况下。)。
然后简单地说,这与你的代码中使用多种语言
有关。我是否正确?
问候,
Thanks Ron,
So in a simple manner, it is a code block to make things easier for
mixed-language programming(for the original C library in your case.).
Then briefly speaking, this is related to using more than one language
in your code. Am I correct?
Regards,
" utab" < um ******** @ gmail.com写信息
新闻:11 ********************* @ h48g2000cwc.googlegro ups.com ...
"utab" <um********@gmail.comwrote in message
news:11*********************@h48g2000cwc.googlegro ups.com...
>
Moonlit写道:
>
Moonlit wrote:
> Hi
-
" utab" < um ******** @ gmail.com在留言中写道
新闻:11 ********************** @ e3g2000cwe.googlegr oups.com ...
>Hi
-
"utab" <um********@gmail.comwrote in message
news:11**********************@e3g2000cwe.googlegr oups.com...
亲爱的,
在编程术语中,什么是包装器,在哪里使用?
Dear all,
In programming terminology, what is a wrapper and where is it used?
好吧,例如,您可以使用围绕常规C />代码的C ++包装类。
例如,在我的个人通用库中,我有一个包装器pnglib libary我可以打开一个.png文件的ifstream并用
运算符>读它/或者用运算符<<来写png文件。这也适用于内存流等.C ++包装器负责内存分配和释放内存以及设置指向静态成员的指针的复杂性。
替换标准的C FILE导向操作。
即复杂性在C ++包装类中。包装类本身非常简单易用。每次我都可以用非常简单的方式加载和保存png,而不是查看每次手册。
Well for instance you could use a C++ wrapper class around regular C
code.
For instance in my personal generic library I have a wrapper class around
the pnglib libary I can the open an ifstream of a .png file and read it
with
operator>or write png files with operator<<. This also works for memory
streams etc. The C++ wrapper takes care of memory allocation and freeing
the
memory and of the complexity of setting the pointers to static members to
replace the standard C FILE oriented operations.
i.e. the complexity is inside the C++ wrapper class. The wrapper class
itself is extremely simple to use. Instead of looking in the manual of
png
everytime I can now load and save png in a very simple way.
>
问候
>
Regards
此致,Ron AF Greve
http://moonlit.xs4all.nl
谢谢Ron,
因此,以简单的方式,它是一个代码块,使事情变得更容易
混合语言编程(对于原始在你的情况下C库。)。
然后简单地说,这与你的代码中使用多种语言
有关。我对么?
Thanks Ron,
So in a simple manner, it is a code block to make things easier for
mixed-language programming(for the original C library in your case.).
Then briefly speaking, this is related to using more than one language
in your code. Am I correct?
我认为确实大多数(如果不是总是)用来简化事情。
第二个陈述是更难以回答,因为C代表的是大部分也是C ++。但是我的所有包装类确实围绕着常规的
C函数/库,而不是围绕C ++库。但是我可以想象,当你有一个复杂的C ++库并且你只想使用它的一部分时,你可能仍然希望在它周围编写一个包装类(然后也许
图书馆本身应该重新设计)。但从实际的角度来看,我认为这是正确的。
I think it is indeed mostly ( if not always ) used to make things easier.
The second statement is a bit more difficult to answer since C is for the
most part also C++. But all of my wrapper classes are indeed around regular
C functions/ libraries and not around C++ libraries. But I could imagine
that when you have a complex C++ library and you only want to use part of it
you might still want to write a wrapper class around it (then again maybe
the library itself should have been redesigned) . But from a practical point
of view I think that is right.
>
问候,
>
Regards,
-
问候,Ron AF Greve
http://moonlit.xs4all .nl
这篇关于什么是包装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!