void listFileNames(std::string directory){ std::vector<std::string> filesToRead; DIR *pDIR; struct dirent *entry; std::string dirTemp = "./" + directory; const char* dir = dirTemp.c_str(); if( (pDIR=opendir(dir)) ){ while((entry = readdir(pDIR))){ if( strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0 ){ std::string temp =entry->d_name; if ( temp == "LineCounter" || temp == "realOutput.txt") { continue; } if (hasDot(temp) == false) { temp = directory +"/" + temp; listFileNames(temp); continue; } if (isCodeFile(temp) == false) { continue; } if (directory.length() !=0) { temp = directory +"/" +temp; } countLinesForOneFile(fileNameFormatter(temp)); } } closedir(pDIR); } }
void Trhythm::debug(const char* text) const { if (m_r == e_none) qDebug() << text << "no rhythm"; else { qDebug() << text << xmlType() << "| rest" << isRest() << "| dot" << hasDot() << "| triplet" << isTriplet() << "| duration" << duration() << "| beam" << beam() << "| tie" << tie() << "| stem" << (stemDown() ? "down" : "up") << "|" << (m_prefs % 8) << m_prefs; } }
QString Trhythm::string() const { QString ret = QString::number(weight()); if (isRest()) ret.prepend(QStringLiteral("R")); if (hasDot()) ret.append(QStringLiteral(".")); else if (isTriplet()) ret.append(QStringLiteral("^3")); return ret; }
bool DamageOverTimeList::healState(CreatureObject* victim, uint64 dotType, float reduction, bool sendMsg) { Locker locker(&guard); if (!hasDot()) return reduction; Vector<DamageOverTime*> timeVec; for (int i = 0; i < size(); i++) { Vector<DamageOverTime>* vector = &elementAt(i).getValue(); for (int j = 0; j < vector->size(); j++) { DamageOverTime* dot = &vector->elementAt(j); if (dot->getType() == dotType && !dot->isPast()) timeVec.add(dot); } } bool expired = true; float reductionLeft = reduction; for (int i = 0; i < timeVec.size(); i++) { DamageOverTime* dot = timeVec.elementAt(i); if (!dot->isPast()) { reductionLeft = dot->reduceTick(reductionLeft); // reduceTick() *should* be guaranteed to return a non-negative value, // but since this is a float, we want to make sure if (reductionLeft <= 0.f) { // we ran out of juice in our cure, so don't expire the dotType, // ie, maintain the state with a reduced damage per tick expired = false; break; } } } if (expired) { locker.release(); victim->clearState(dotType); return true; } if (sendMsg) sendDecreaseMessage(victim, dotType); return false; }
void Trhythm::split(TrhythmList& twoRhythms) const { if (rhythm() == e_none || rhythm() == e_sixteenth) return; // nothing to split if (hasDot()) { twoRhythms << Trhythm(rhythm(), isRest(), false) // no triplet for sure << Trhythm(static_cast<Erhythm>(rhythm() + 1), isRest()); // Also when there is a dot, for sure it is not lowest possible rhythm, so we may add 1 to rhythm value to obtain its half } else { Trhythm half(static_cast<Erhythm>(rhythm() + 1), isRest(), false, isTriplet()); twoRhythms << half << half; } if (!isRest() && twoRhythms.size() == 2) { twoRhythms.first().setStemDown(stemDown()); twoRhythms.last().setStemDown(stemDown()); } }
void DamageOverTimeList::multiplyAllDOTDurations(float multiplier) { Locker locker(&guard); if(!hasDot()) return; for (int i = 0; i < size(); i++) { Vector<DamageOverTime>* vector = &elementAt(i).getValue(); for (int j = 0; j < vector->size(); j++) { DamageOverTime* dot = &vector->elementAt(j); if (!dot->isPast()) { dot->multiplyDuration(multiplier); } } } }
unsigned int Unit::getBitFlagsByType<Unit::_7>(char ch, bool with_dot) { unsigned int dot_bit = (with_dot||hasDot(ch))?DOT_BIT:0; switch(ch) { case ' ': return 0b00000000|dot_bit; // 32 case '!': return 0b00000010|dot_bit; // 33 case '"': return 0b00100010|dot_bit; // 34 case '#': return 0b01110110|dot_bit; // 35 case '$': return 0b01101101|dot_bit; // 36 case '%': return 0b00101101|dot_bit; // 37 case '&': return 0b01111011|dot_bit; // 38 case '\'':return 0b00100000|dot_bit; // 39 case '(': return 0b00111001|dot_bit; // 40 case ')': return 0b00001111|dot_bit; // 41 case '*': return 0b01100011|dot_bit; // 42 case '+': return 0b01110000|dot_bit; // 43 case ',': return 0b00000100|dot_bit; // 44 case '-': return 0b01000000|dot_bit; // 45 case '.': return 0b00000000|DOT_BIT; // 46 case '/': return 0b01010010|dot_bit; // 47 case '0': return 0b00111111|dot_bit; // 48 case '1': return 0b00000110|dot_bit; // 49 case '2': return 0b01011011|dot_bit; // 50 case '3': return 0b01001111|dot_bit; // 51 case '4': return 0b01100110|dot_bit; // 52 case '5': return 0b01101101|dot_bit; // 53 case '6': return 0b01111101|dot_bit; // 54 case '7': return 0b00000111|dot_bit; // 55 case '8': return 0b01111111|dot_bit; // 56 case '9': return 0b01101111|dot_bit; // 57 case ':': return 0b01001000|dot_bit; // 58 case ';': return 0b01001100|dot_bit; // 59 case '<': return 0b01100001|dot_bit; // 60 case '=': return 0b01000001|dot_bit; // 61 case '>': return 0b01000011|dot_bit; // 62 case '?': return 0b01010011|dot_bit; // 63 case '@': return 0b01011111|dot_bit; // 64 case 'A': return 0b01110111|dot_bit; // 65 case 'B': return 0b01111100|dot_bit; // 66 case 'C': return 0b00111001|dot_bit; // 67 case 'D': return 0b01011110|dot_bit; // 68 case 'E': return 0b01111001|dot_bit; // 69 case 'F': return 0b01110001|dot_bit; // 70 case 'G': return 0b00111101|dot_bit; // 71 case 'H': return 0b01110110|dot_bit; // 72 case 'I': return 0b00110000|dot_bit; // 73 case 'J': return 0b00011110|dot_bit; // 74 case 'K': return 0b01110101|dot_bit; // 75 case 'L': return 0b00111000|dot_bit; // 76 case 'M': return 0b01010101|dot_bit; // 77 case 'N': return 0b00110111|dot_bit; // 78 case 'O': return 0b00111111|dot_bit; // 79 case 'P': return 0b01110011|dot_bit; // 80 case 'Q': return 0b01100111|dot_bit; // 81 case 'R': return 0b01010000|dot_bit; // 82 case 'S': return 0b01101101|dot_bit; // 83 case 'T': return 0b00110001|dot_bit; // 84 case 'U': return 0b00111110|dot_bit; // 85 case 'V': return 0b00101010|dot_bit; // 86 case 'W': return 0b01111110|dot_bit; // 87 case 'X': return 0b01110110|dot_bit; // 88 case 'Y': return 0b01101110|dot_bit; // 89 case 'Z': return 0b00011011|dot_bit; // 90 case '[': return 0b00111001|dot_bit; // 91 case '\\':return 0b01100100|dot_bit; // 92 case ']': return 0b00001111|dot_bit; // 93 case '^': return 0b00100011|dot_bit; // 94 case '_': return 0b00001000|dot_bit; // 95 case '`': return 0b00000011|dot_bit; // 96 case 'a': return 0b01011111|dot_bit; // 97 case 'b': return 0b01111100|dot_bit; // 98 case 'c': return 0b01011000|dot_bit; // 99 case 'd': return 0b01011110|dot_bit; // 100 case 'e': return 0b01111011|dot_bit; // 101 case 'f': return 0b01110001|dot_bit; // 102 case 'g': return 0b01101111|dot_bit; // 103 case 'h': return 0b01110100|dot_bit; // 104 case 'i': return 0b00010000|dot_bit; // 105 case 'j': return 0b00001110|dot_bit; // 106 case 'k': return 0b01110101|dot_bit; // 107 case 'l': return 0b00110000|dot_bit; // 108 case 'm': return 0b01010100|dot_bit; // 109 case 'n': return 0b01010100|dot_bit; // 110 case 'o': return 0b01011100|dot_bit; // 111 case 'p': return 0b01110011|dot_bit; // 112 case 'q': return 0b01100111|dot_bit; // 113 case 'r': return 0b01010000|dot_bit; // 114 case 's': return 0b01101101|dot_bit; // 115 case 't': return 0b01111000|dot_bit; // 116 case 'u': return 0b00011100|dot_bit; // 117 case 'v': return 0b00011100|dot_bit; // 118 case 'w': return 0b01111110|dot_bit; // 119 case 'x': return 0b01110110|dot_bit; // 120 case 'y': return 0b01101110|dot_bit; // 121 case 'z': return 0b01011011|dot_bit; // 122 case '{': return 0b00111001|dot_bit; // 123 case '|': return 0b00110000|dot_bit; // 124 case '}': return 0b00001111|dot_bit; // 125 case '~': return 0b01000000|dot_bit; // 126 case '': return 0b01011010|dot_bit; // 127 } return 0b00000000|dot_bit; }
unsigned int Unit::getBitFlagsByType<Unit::_16>(char ch, bool with_dot) { unsigned int dot_bit = (with_dot||hasDot(ch))?DOT_BIT:0; return 0b1111111111111111|dot_bit; }