这可以在每个ISO / IEC 14882:2003实施中完成吗? [英] Could this be done on every ISO/IEC 14882:2003 implementation?
问题描述
这是为gnu.g ++。帮助列表编写的。它相当清楚地说明了我认为C ++缺乏的Java最重要的特性。我真的不认为C ++标准足够用于通用机制来完成下面针对Java演示的可竞争任务。我已经在comp.std.c ++上提出了
,该标准的下一个版本为C ++实现指定了类似的功能。
我知道将Java与C ++进行比较可能不受欢迎,但是C ++缺少Java的某些特性,这给了程序员很大的帮助。
利用可用的库。
为了写这个,我写了下面的bash [gnu.g ++。help]
回复:
*#!/ bin / bash
函数jarlist(){
**** for * j * in * $ {CLASSPATH //:/''*''}; * do *
******** echo * $ j;
*** *完成*
}
函数classlist(){
**** for * j * in * $ {CLASSPATH //:/''*''}; *做
******** jar * -tf * $ j;
****完成*
}
函数jpgrep(){
**** for * j * in * $ {CLASSPATH // :/''*''}; *做
******** h ="" ;;
** ****** h = $(jar * -tf * $ j * | * grep * .class $ * | * grep * $ 1)
******** * c * in * $ h; do
************* echo * $ c;
********完成
****完成*
}
函数jif(){
* *** for * j * in * $ {CLASSPATH //:/''*''}; * do
******** h ="" ;;
******** h = $(jar * -tf * $ j * | * grep * .class $ * | * grep * $ 1)
** ****** * for * c * in * $ h; do
************ test * -n *" $ c" *&& ; * echo * $ c *&& * javap * $ {c %%。class}
********完成
*** *完成*
}
##################### EOF ######## ###########################
如果有一个Java类,我希望在我的代码,我可以将上面列出的代码
放在一个名为〜/ bin / jq的文件中。来源:
Fri Jun 04 11:45:51:> 。 jq
如果我知道该类包含子字符串''System''我输入:
Fri Jun 04 11:45:51:> jpgrep系统
org / apache / xml / utils / SystemIDResolver.class
org / apache / xpath / functions / FuncSystemProperty.class
org / apache / xmlrpc / SystemHandler.class
org / apache / xindice / core / MetaSystemCollection.class
org / apache / xindice / core / SystemCollection.class
如果我想查看每个接口,我输入:
org / apache / xml / utils / SystemIDResolver.class
编译自SystemIDResolver.java
公共类org.apache.xml.utils.SystemIDResolver扩展java.lang.Object {
**** public * org.apache.xml.utils.SystemIDResolver();
**** public * static * java.lang.String * getAbsoluteURI(java.lang.String);
******* throws * javax / xml / transform / TransformerException
**** public * static * java.lang.String
getAbsoluteURIFromRelative(java .lang.String);
**** public * static * java.lang.String
getAbsoluteURI(java.lang.String,java.la ng.String);
******* throws * javax / xml / transform / TransformerException
}
org / apache / xpath / functions / FuncSystemProperty.class
编译自FuncSystemProperty.java
// ...
}
org / apache / xmlrpc / SystemHandler.class
编译自SystemHandler.java
公共类org.apache。 xmlrpc.SystemHandler扩展java.lang.Object
实现org.apache.xmlrpc.ContextXmlR
// ..
execute(java.lang .String,java.util.Vector,org.apac he.xmlrpc.XmlRpcContext);
******* throws * java / lang / Exception
}
org / apache / xindice / core / MetaSystemCollection.class
编译自MetaSystemCollection.java
公共最终班级org.apache.xindice.core.MetaSystemCollection延伸
// ...
这些结果包含我需要的所有东西才能导入类
int o我当前的文件,并获得一个可访问方法的弹出菜单
调用和字段,包括参数列表。
-
STH
哈顿定律:只有一个不可侵犯的法律
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http ://www.mozilla.org
This was written for the gnu.g++.help list. It rather clearly spells out the
most important feature of Java that I believe C++ lacks. I really don''t
believe the C++ Standard sepcifies enough for a generic mechanism to
accomplish the comperable tasks demonstrated for Java below. I''ve already
proposed on comp.std.c++ that the next version of the standard specify a
similar functionality for a C++ implementation.
I know it can be unpopular to compare Java to C++, but there are certain
features of Java which C++ lacks, and which give the programmer significant
leverage to exploit available libraries.
I wrote the following bash for the sake of writing this [gnu.g++.help]
response:
*#!/bin/bash
function jarlist() {
****for*j*in*${CLASSPATH//:/''*''};*do*
********echo*$j;
****done*
}
function classlist() {
****for*j*in*${CLASSPATH//:/''*''};*do
********jar*-tf*$j;
****done*
}
function jpgrep() {
****for*j*in*${CLASSPATH//:/''*''};*do
********h="";
********h=$(jar*-tf*$j*|*grep*.class$*|*grep*$1)
********for*c*in*$h;do
*************echo*$c;
********done
****done*
}
function jif() {
****for*j*in*${CLASSPATH//:/''*''};*do
********h="";
********h=$(jar*-tf*$j*|*grep*.class$*|*grep*$1)
********for*c*in*$h;do
************test*-n*"$c"*&&*echo*$c*&&*javap*${c%%.class}
********done
****done*
}
##################### EOF ###################################
If there is a Java class I wish to use in my code, I can put the code listed
above in a file called ~/bin/jq. Source it:
Fri Jun 04 11:45:51:> . jq
If I know the class contains the substring ''System'' I type:
Fri Jun 04 11:45:51:> jpgrep System
org/apache/xml/utils/SystemIDResolver.class
org/apache/xpath/functions/FuncSystemProperty.class
org/apache/xmlrpc/SystemHandler.class
org/apache/xindice/core/MetaSystemCollection.class
org/apache/xindice/core/SystemCollection.class
If I want to see the interfaces for each of these, I enter:
org/apache/xml/utils/SystemIDResolver.class
Compiled from "SystemIDResolver.java"
public class org.apache.xml.utils.SystemIDResolver extends java.lang.Object{
****public*org.apache.xml.utils.SystemIDResolver() ;
****public*static*java.lang.String*getAbsoluteURI( java.lang.String);
*******throws*javax/xml/transform/TransformerException
****public*static*java.lang.String
getAbsoluteURIFromRelative(java.lang.String);
****public*static*java.lang.String
getAbsoluteURI(java.lang.String,java.lang.String);
*******throws*javax/xml/transform/TransformerException
}
org/apache/xpath/functions/FuncSystemProperty.class
Compiled from "FuncSystemProperty.java"
//...
}
org/apache/xmlrpc/SystemHandler.class
Compiled from "SystemHandler.java"
public class org.apache.xmlrpc.SystemHandler extends java.lang.Object
implements org.apache.xmlrpc.ContextXmlR
//..
execute(java.lang.String,java.util.Vector,org.apac he.xmlrpc.XmlRpcContext);
*******throws*java/lang/Exception
}
org/apache/xindice/core/MetaSystemCollection.class
Compiled from "MetaSystemCollection.java"
public final class org.apache.xindice.core.MetaSystemCollection extends
//...
Those results contain everything I need in order to have the class imported
into my current file and to get a pop-up menu of accessible method
invocations and fields, including a parameterlist.
--
STH
Hatton''s Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
推荐答案
{CLASSPATH //:/''*''}; * do *
******** echo *
{CLASSPATH//:/''*''};*do*
********echo*
j;
****完成*
}
函数classlist(){
**** for * j * in *
j;
****done*
}
function classlist() {
****for*j*in*
{ CLASSPATH //:/''*''}; *做
******** jar * -tf *
{CLASSPATH//:/''*''};*do
********jar*-tf*
这篇关于这可以在每个ISO / IEC 14882:2003实施中完成吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!