function changeNamespace($newNamespace, $file) { $contents = file_get_contents($file); $info = getClassInfo($file); str_ireplace($info['namespace'], $newNamespace, $contents); file_put_contents($file, $contents); }
foreach ($files_todo as $f) { if ($debug > 0) { print "File name: '{$f}'\n"; } //file name (without path) $basename = basename($f); //class name (for source and header files) $classname = substr($basename, 0, -2); //test name (for source and header files) $testnames = array("src/tests/class_tests/openms/source/" . $classname . "_test.cpp", "src/tests/class_tests/openms_gui/source/" . $classname . "_test.cpp"); // file content $file = file($src_path . "/" . $f); ######################### load class info ################################ $dont_load = array("IsotopeCluster.h", "RangeUtils.h", "ComparatorUtils.h", "StatisticFunctions.h", "KernelTraits.h", "StandardTypes.h", "DimensionDescription.h", "MathFunctions.h", "ClassTest.h", "LayerData.h", "config.h", "OpenSwathAlgoConfig.h", "XMLSchemes.h", "Serialization.h", "Exception.h", "GlobalExceptionHandler.h", "Types.h", "TypeAsName.h", "PrecisionWrapper.h", "Macros.h", "Benchmark.h", "Constants.h", "IsotopeWaveletConstants.h", "openms_package_version.h"); if (!endsWith($f, "_impl.h") && endsWith($f, ".h") && !in_array($basename, $dont_load)) { $class_info = getClassInfo($bin_path, $f, $debug); } else { unset($class_info); } ########################### guards ###################################### if (in_array("guards", $tests)) { $dont_report = array("TypeNameIdStringMiscellanyDefs.h"); if (endsWith($f, ".h")) { $message = ""; $result = true; for ($i = 0; $i < count($file); $i++) { $line = trim($file[$i]); if (beginsWith($line, "#ifndef")) { $guard = trim(substr($line, 8)); $nextline = trim($file[$i + 1]); //header guards
} } //file_put_contents('./writeRunHour.txt','$docArr:'."\r\n".var_export($docArr,true)."\r\n",FILE_APPEND|LOCK_EX); //exit("This is exit...\r\n"); /* 去掉 $tmpDoc 中作为大黑字的 */ if ($topOneArticleArr) { foreach ($topOneArticleArr as $k => $v) { unset($tmpDoc[$k][array_search($v, $tmpDoc[$k])]); } } /* 获取各文章对应的频道(域名) */ foreach ($tmpDoc as $key => $v) { $tpArr = array(); foreach ($v as $k => $vv) { $classid = $docArr['docid'][$vv]['class_id']; $tpArr[$vv] = getClassInfo($classid); } $docInfo[$key] = $tpArr; } /*按频道分组 数据*/ foreach ($docInfo as $k => $v) { foreach ($v as $key => $vv) { //$groupId= $dataInfo[$vv]; if ($topOneArticleArr[$k] != $key) { #排除预留大黑字的一条 ,不参与下面的排序 $docInfoChannel[$k][$vv][] = $key; } } } /*筛选出同频道(同二级域名)不够两条的*/ $tmp = array();
} $path = $argv[1]; $header = $argv[2]; $basename = basename($header); $test_name = "{$path}/source/TEST/" . substr($basename, 0, -2) . "_test.cpp"; ######################## determine tested methods ############################## $tmp = parseTestFile($test_name); $tests = $tmp["tests"]; if ($verbose) { print "\n\nTests:\n"; foreach ($tests as $t) { print " '{$t}'\n"; } } ######################## determine declared methods ########################## $class_info = getClassInfo($path, $header, 0); $methods = $class_info["public-long"]; // print methods in verbose mode if ($verbose) { print "\n\\Methods to correct:\n"; foreach ($methods as $m) { print " '{$m}'\n"; } } ######################deter################# if (count($tests) == 0 || count($methods) == 0) { print "Nothing to do (no tests or methods)\n"; exit; } $replace_strings = array("\t" => "", " " => "", "std::" => "", "OpenMS::" => ""); $dists = array();
<!-- InClass Assistant 2015 Feed en tiempo real --> <?php require_once "functions.php"; require_once "session.php"; require_once "authorizeUserClassTask.php"; $task = getTaskInfo($_GET['tid']); $class = getClassInfo($_GET['gid']); if (!$task['active']) { header("Location:home.php"); } ?> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <!-- Load css Files --> <link href="./metro/css/metro-bootstrap.css" rel="stylesheet"> <!--<link href="./metro/css/metro-bootstrap-responsive.css" rel="stylesheet">--> <link href="./metro/min/iconFont.min.css" rel="stylesheet"> <link href="./metro/js/prettify/prettify.css" rel="stylesheet"> <link href="./css/style.css" rel="stylesheet"> <!-- Load JavaScript Libraries --> <script src="./metro/js/jquery/jquery.min.js"></script>
print "Usage: create_test.php <Absolute path to OpenMS build dir> <Absolute path to header> [Author]\n"; " <header_file> -- the header of the class to create the test from.\n"; " [Author] -- the author argument is optional, the name will be added to the Maintainer/Author section.\n"; exit; } $path = $argv[1]; $file = $argv[2]; $class = substr(basename($file), 0, -2); $pathToHeader = substr($file, strpos($file, "include/OpenMS") + 8); $user = ""; if ($argc == 4) { // we got a user name $user = trim($argv[3], "\""); } #load file info $class_info = getClassInfo($path, $file, 0); ?> // -------------------------------------------------------------------------- // OpenMS -- Open-Source Mass Spectrometry // -------------------------------------------------------------------------- // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen, // ETH Zurich, and Freie Universitaet Berlin 2002-<?php print date("Y"); ?> . // // This software is released under a three-clause BSD license: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the