void CompilGenerator::generateEnumerationPrefix(const EnumerationSPtr& pEnumeration) { if (pEnumeration->structure().lock()) { if (!table().isEmpty()) { eot(declarationStream); eol(declarationStream); } bAddNewLine = true; } switch (pEnumeration->cast().value()) { case CastableType::ECast::kWeak: line() << "weak "; break; case CastableType::ECast::kStrong: line() << "strong "; break; default: assert(false && "unknown cast type"); } line() << "enum"; TypeSPtr pType = pEnumeration->parameterType().lock(); if (pType) { line() << "<" << pType->name()->value() << ">"; } line() << " " << pEnumeration->name()->value(); openBlock(declarationStream); }
void GameWidget::newGame() { for(int i=0;i<Max;i++) { for(int j=0;j<Max;j++) { map[i][j]->setVisible(false); map[i][j]->reBrothers(); map[i][j]->setInit(); } } for(int i=0;i<hCount;i++) { for(int j=0;j<wCount;j++) { map[i][j]->setVisible(true); connect(map[i][j],SIGNAL(start()),this,SLOT(createGame())); connect(map[i][j],SIGNAL(isOpen()),this,SLOT(openBlock())); connect(map[i][j],SIGNAL(isBoom()),this,SLOT(gameMiss())); connect(map[i][j],SIGNAL(isFlag()),this,SLOT(isFlag())); connect(map[i][j],SIGNAL(disFlag()),this,SLOT(disFlag())); map[i][j]->unLocked(); } } firstRun=1; emit mineSum(MineCount); }
void CompilGenerator::generateStructurePrefix(const StructureSPtr& pStructure) { if (pStructure->controlled()) line() << "controlled "; if (pStructure->immutable()) line() << "immutable "; if (pStructure->partial()) line() << "partial "; line() << "structure " << pStructure->name()->value(); int indexOffset = 0; StructureSPtr pBaseStructure = pStructure->baseStructure().lock(); if (pBaseStructure) { eol(declarationStream); ++indexOffset; ++mIndent[declarationStream]; line() << "inherit " << pBaseStructure->name()->value(); const std::vector<ObjectSPtr>& objects = pStructure->objects(); bool first_alter = true; std::vector<ObjectSPtr>::const_iterator it; for (it = objects.begin(); it != objects.end(); ++it) { AlterSPtr pAlter = ObjectFactory::downcastAlter(*it); if (!pAlter) continue; if (first_alter) { first_alter = false; eol(declarationStream); ++mIndent[declarationStream]; ++indexOffset; table() << TableAligner::row() << "alter "; } else { table() << "," << TableAligner::row(); } table() << TableAligner::col() << pAlter->field()->name()->value() << " " << TableAligner::col() << "= " << pAlter->defaultValue()->value(); } } mIndent[declarationStream] -= indexOffset; openBlock(declarationStream, indexOffset); }
void CompilGenerator::generateSpecimenPrefix(const SpecimenSPtr& pSpecimen) { line() << "specimen"; TypeSPtr pType = pSpecimen->parameterType().lock(); if (pType) { line() << "<" << pType->name()->value() << ">"; } line() << " " << pSpecimen->name()->value(); openBlock(declarationStream); }
static bool downloadBlockRun(BigFileReaderData * data, char * chrom, struct fileOffsetSize * firstBlock, struct fileOffsetSize * afterBlock, bits64 mergedSize) { char * mergedBuf, *blockBuf; struct fileOffsetSize * block; udcSeek(data->udc, firstBlock->offset); blockBuf = mergedBuf = (char *) needLargeMem(mergedSize); udcMustRead(data->udc, mergedBuf, mergedSize); for (block = firstBlock; block != afterBlock; block = block->next) { if (openBlock(data, block, blockBuf)) { freeMem(mergedBuf); return true; } blockBuf += block->size; } freeMem(mergedBuf); return false; }
void CompilGenerator::generateFactoryPrefix(const FactorySPtr& pFactory) { switch (pFactory->type().value()) { case Factory::EType::kHierarchy: line() << "hierarchy "; break; case Factory::EType::kObject: line() << "object "; break; default: assert(false && "unknown cast type"); } line() << "factory"; TypeSPtr pType = pFactory->parameterType().lock(); if (pType) { line() << "<" << pType->name()->value() << ">"; } line() << " " << pFactory->name()->value(); openBlock(declarationStream); }
void CompilGenerator::generateMethodPrefix(const MethodSPtr& pMethod) { line() << "method " << pMethod->name()->value(); openBlock(declarationStream); }
void CompilGenerator::generateInterfacePrefix(const InterfaceSPtr& pInterface) { line() << "interface " << pInterface->name()->value(); openBlock(declarationStream); }
bool CppFlagsEnumerationGenerator::generate() { includeHeaders(declarationStream, Dependency::global_section); std::string guard = frm->headerGuard("core/flags_enumeration.hpp"); line() << "#ifndef " << guard; eol(declarationStream); line() << "#define " << guard; eol(declarationStream); eol(declarationStream); includeHeaders(declarationStream, Dependency::private_section); cf::TypeSPtr decoratedType = T; cf::TypeSPtr decoratedInherit = F; cf::TypeSPtr decoratedInheritRef = cstFRef; cf::ConstructorNameSPtr class_name = cf::constructorNameRef("flags_enumeration"); cf::VariableNameSPtr memberValue = frm->memberVariableName(value); cf::ArgumentSPtr argMask = cf::argumentRef() << decoratedInheritRef << cf::variableNameRef("mask"); cf::ArgumentSPtr argValue = cf::argumentRef() << decoratedInheritRef << value; line() << "template<class " << T->name()->value() << ", class " << F->name()->value() << ">"; eol(declarationStream); line() << "class " << class_name; openBlock(declarationStream); line() << "public:"; eol(declarationStream, -1); line() << "// Default constructor - sets the value to invalid"; eol(declarationStream); fdef() << (cf::constructorRef() << class_name); eofd(declarationStream); line() << ": " << (cf::initializationRef() << memberValue << cf::parameterValueRef("0")); openBlock(declarationStream, 1); closeBlock(declarationStream); eol(declarationStream); fdef() << (cf::constructorRef() << class_name << (cf::argumentRef() << decoratedType << value)); eofd(declarationStream); line() << ": " << (cf::initializationRef() << memberValue << frm->parameterValue(value)); openBlock(declarationStream, 1); closeBlock(declarationStream); eol(declarationStream); fdef() << (cf::methodRef() << decoratedType << fnValue << cf::EMethodDeclaration::const_()); openBlock(declarationStream); line() << "return " << memberValue << ";"; closeBlock(declarationStream); eol(declarationStream); commentInLine(declarationStream, "Resets the flags included in the mask to the state in value"); fdef() << (cf::methodRef() << vd << fnReset << argMask << argValue); openBlock(declarationStream); line() << memberValue << " = value.value() | (this->value() & ~mask.value());"; closeBlock(declarationStream); eol(declarationStream); commentInLine(declarationStream, "Sets the flags included in the mask. Equivalent to reset(mask, all)."); fdef() << (cf::methodRef() << vd << fnSet << argMask); openBlock(declarationStream); line() << memberValue << " |= mask.value();"; closeBlock(declarationStream); eol(declarationStream); commentInLine(declarationStream, "Clears the flags included in the mask. Equivalent to reset(mask, nil)."); fdef() << (cf::methodRef() << vd << fnClear << argMask); openBlock(declarationStream); line() << memberValue << " &= ~mask.value();"; closeBlock(declarationStream); eol(declarationStream); commentInLine(declarationStream, "Turns the flags included in the mask."); fdef() << (cf::methodRef() << vd << fnTurn << argMask); openBlock(declarationStream); line() << memberValue << " ^= mask.value();"; closeBlock(declarationStream); eol(declarationStream); commentInLine(declarationStream, "Returns assemble of the current flags with the flags from the mask to " "the state in value. This is immutable version of reset."); fdef() << (cf::methodRef() << decoratedInherit << fnAssemble << argMask << argValue << cf::EMethodDeclaration::const_()); openBlock(declarationStream); line() << "return " << F->name()->value() << "(value.value() | (this->value() & ~mask.value()));"; closeBlock(declarationStream); eol(declarationStream); commentInLine(declarationStream, "Returns combination of the flags included in the mask. " "This is immutable version of set."); fdef() << (cf::methodRef() << decoratedInherit << fnCombine << argMask << cf::EMethodDeclaration::const_()); openBlock(declarationStream); line() << "return " << F->name()->value() << "(value() | mask.value());"; closeBlock(declarationStream); eol(declarationStream); commentInLine(declarationStream, "Returns intersection of the flags included in the mask. " "This is immutable version of clear."); fdef() << (cf::methodRef() << decoratedInherit << fnIntersect << argMask << cf::EMethodDeclaration::const_()); openBlock(declarationStream); line() << "return " << F->name()->value() << "(value() & ~mask.value());"; closeBlock(declarationStream); eol(declarationStream); commentInLine(declarationStream, "Returns flipped the flags included in the mask. " "This is immutable version of turn."); fdef() << (cf::methodRef() << decoratedInherit << fnFlip << argMask << cf::EMethodDeclaration::const_()); openBlock(declarationStream); line() << "return " << F->name()->value() << "(value() ^ mask.value());"; closeBlock(declarationStream); eol(declarationStream); commentInLine(declarationStream, "Tests if the flags included in the mask are the same state as state in value"); fdef() << (cf::methodRef() << bl << fnTest << argMask << argValue << cf::EMethodDeclaration::const_()); openBlock(declarationStream); line() << "return (this->value() & mask.value()) == value.value();"; closeBlock(declarationStream); eol(declarationStream); commentInLine(declarationStream, "Tests if the flags included in the mask are set. Equivalent to test(mask, all)."); fdef() << (cf::methodRef() << bl << fnIsSet << argMask << cf::EMethodDeclaration::const_()); openBlock(declarationStream); line() << "return (value() & mask.value()) == mask.value();"; closeBlock(declarationStream); eol(declarationStream); commentInLine(declarationStream, "Tests if the flags included in the mask are clear. Equivalent to test(mask, nil)."); fdef() << (cf::methodRef() << bl << fnIsClear << argMask << cf::EMethodDeclaration::const_()); openBlock(declarationStream); line() << "return (value() & mask.value()) == 0;"; closeBlock(declarationStream); eol(declarationStream); line() << "protected:"; eol(declarationStream, -1); line() << T->name()->value() << " " << memberValue << ";"; eol(declarationStream); closeBlock(declarationStream, "};"); eol(declarationStream); line() << "#endif // " << guard; eol(declarationStream); eol(declarationStream); return serializeStreams(); }